|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Messager
The Messager interface defines the methods which must be implemented to
provide communication between node instances. An implementation makes
use of the fact that every running node instance is Messageable,
and local access is provided through the SandRoot. A Messager
implementation may be implemented over a variety of technologies
including (but not limited to):
Messaging is a critical function and all implementations are assumed
be both efficient and trustworthy. If a call terminates normally, then
the application may assume that communications are complete. Because
messaging is critical, any exception thrown internally by a Messager
implementation will likely result in a node shutdown, or a systemwide
shutdown.
Sidenote on topic-based messaging implementations:
Most enterprise systems rely on established message servers to provide communications between systems. The Messager interface represents a direct contract between a SAND application and messaging server. In the simplest case, topics are established corresponding to the node instance names. The
sendmethod corresponds topublish, andsubscribeis what you would expect on the other end. A synchronous call is typically "faked" through publishing on a topic and then waiting until a response is received on a temporary return topic before returning control. Synchronous calls can also be accomplished via RPC, provided that timeout can be achieved.
See also the
messaging overview.
| Field Summary | |
|---|---|
static int |
MODE_DIRECT
Communicate between nodes directly |
static int |
MODE_INVALID
Invalid communications value |
static int |
MODE_SECURE
Communicate between nodes through securing Authorizers |
static int |
OPTIMIZE_IF_POSSIBLE
If it's possible to optimize, do so. |
static int |
OPTIMIZE_NEVER
Do not optimize. |
static int |
WIRE_BASICSECURITY
This messager provides base level security through a secure protocol (like https), but supplemental encryption is supported. |
static int |
WIRE_SECURECOMMS
This messager handles the security of all communications. |
static int |
WIRE_TRANSPORTONLY
The messager provides message transport only. |
| Method Summary | |
|---|---|
int |
getWireSecurity()
Return one of the WIRE_ constants describing the level of transport security provided by this messager for MODE_SECURE communications. |
void |
init(Messageable node,
NodeInstance instance)
Initialize the Messager implementation with everything it needs to do its work. |
SandMessage |
query(SandMessage msg,
java.lang.String recipientInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
Send a synchronous request to the specified recipient and return the result. |
void |
queryReceiver(Messageable node,
java.lang.String messageClass,
java.lang.String localAuthorizerInstanceName)
Register the node with the local authorizer, as recipient for the specified class of queries. |
void |
send(SandMessage msg,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
Broadcast a message to all subscribers. |
void |
shutdown()
Shut down the Messager and release any cached resources. |
void |
subscribe(Messageable node,
java.lang.String messageClass,
java.lang.String senderInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName,
SandAttrVal[] matchDescription)
Register a node as a subscriber to broadcast messages of the type specified coming from the specified source. |
void |
unsubscribe(Messageable node,
java.lang.String messageClass,
java.lang.String senderInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
Unregister a node as a subscriber to broadcast messages of the type specified coming from the specified source. |
| Field Detail |
|---|
static final int OPTIMIZE_IF_POSSIBLE
static final int OPTIMIZE_NEVER
static final int MODE_INVALID
static final int MODE_DIRECT
static final int MODE_SECURE
static final int WIRE_TRANSPORTONLY
static final int WIRE_BASICSECURITY
static final int WIRE_SECURECOMMS
| Method Detail |
|---|
void init(Messageable node,
NodeInstance instance)
throws MessagerException
MessagerExceptionvoid shutdown()
void send(SandMessage msg,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
throws MessagerException
MessagerException
void subscribe(Messageable node,
java.lang.String messageClass,
java.lang.String senderInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName,
SandAttrVal[] matchDescription)
throws MessagerException
If matchDescription is not null, then it is only necessary
to deliver messages matching the description. A Messager may
choose not to send unmatching messages for efficiency reasons. A
subscribing node must always be prepared to accept any message of
the given type, even those not matching the description.
MessagerException
void unsubscribe(Messageable node,
java.lang.String messageClass,
java.lang.String senderInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
throws MessagerException
MessagerException
SandMessage query(SandMessage msg,
java.lang.String recipientInstanceName,
int optimize,
int mode,
java.lang.String localAuthorizerInstanceName)
throws MessagerException
There is no corresponding receive method defined
for the interface. While the use of a receive method
is common in Messager implementations, it is not strictly necessary,
and its signature tends vary from one implementation to the next.
MessagerException
void queryReceiver(Messageable node,
java.lang.String messageClass,
java.lang.String localAuthorizerInstanceName)
throws MessagerException
If this method is given null or the empty string for the
localAuthorizerInstanceName, it can simply ignore the call.
MessagerExceptionint getWireSecurity()
By returning WIRE_SECURECOMMS, a messager implementation can effectively override use of encryption in the Authorizer. If a messager provides secure communications, but it is not appropriate to override Authorizer encryption in all cases, then the Messager should return WIRE_BASICSECURITY, and NullEncryptors can be configured to optimize specific Authorizer paths.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||