Interface MessageDispatchManager
-
public interface MessageDispatchManager
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_REQUEST_TIMEOUT_MS
static java.lang.String
KEY_CLIENT_SESSION_ID
static java.lang.String
KEY_HAS_ROLE
static java.lang.String
KEY_HOSTNAME
static java.lang.String
KEY_REMOTE_SERVERS
static java.lang.String
KEY_SCOPE
static java.lang.String
KEY_SEND_SERVER_ID
static java.lang.String
KEY_TIMEOUT
static java.lang.String
KEY_USER
static java.lang.String
MESSAGE_TYPE
static java.lang.String
SCOPE_CLIENT_GATEWAY
static java.lang.String
SCOPE_CLIENT_ONLY
static java.lang.String
SCOPE_GATEWAY_ONLY
static java.lang.String
SCOPE_SESSION
static java.lang.String
SECURITY_USER_ROLES
static java.lang.String
SECURITY_USER_ZONES
static java.lang.String
STATUS_SENT
static java.lang.String
STATUS_SKIPPED
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<java.lang.String>
dispatch(java.lang.String project, java.lang.String messageHandler, java.util.Properties filterParams)
Sends a message to a message handler in a project.java.util.List<java.lang.String>
dispatch(java.lang.String project, java.lang.String messageHandler, org.python.core.PyDictionary messagePayload, java.util.Properties filterParams)
Sends a message to a message handler in a project.void
dispatchRequest(java.lang.String project, java.lang.String messageHandler, org.python.core.PyDictionary messagePayload, java.util.Properties params, MessageResultHandler resultHandler)
Dispatches a "request", which is a message that expects a result.
-
-
-
Field Detail
-
DEFAULT_REQUEST_TIMEOUT_MS
static final java.lang.String DEFAULT_REQUEST_TIMEOUT_MS
- See Also:
- Constant Field Values
-
MESSAGE_TYPE
static final java.lang.String MESSAGE_TYPE
- See Also:
- Constant Field Values
-
KEY_CLIENT_SESSION_ID
static final java.lang.String KEY_CLIENT_SESSION_ID
- See Also:
- Constant Field Values
-
KEY_SCOPE
static final java.lang.String KEY_SCOPE
- See Also:
- Constant Field Values
-
KEY_USER
static final java.lang.String KEY_USER
- See Also:
- Constant Field Values
-
KEY_HAS_ROLE
static final java.lang.String KEY_HAS_ROLE
- See Also:
- Constant Field Values
-
KEY_HOSTNAME
static final java.lang.String KEY_HOSTNAME
- See Also:
- Constant Field Values
-
KEY_REMOTE_SERVERS
static final java.lang.String KEY_REMOTE_SERVERS
- See Also:
- Constant Field Values
-
KEY_SEND_SERVER_ID
static final java.lang.String KEY_SEND_SERVER_ID
- See Also:
- Constant Field Values
-
KEY_TIMEOUT
static final java.lang.String KEY_TIMEOUT
- See Also:
- Constant Field Values
-
SECURITY_USER_ZONES
static final java.lang.String SECURITY_USER_ZONES
- See Also:
- Constant Field Values
-
SECURITY_USER_ROLES
static final java.lang.String SECURITY_USER_ROLES
- See Also:
- Constant Field Values
-
SCOPE_CLIENT_ONLY
static final java.lang.String SCOPE_CLIENT_ONLY
- See Also:
- Constant Field Values
-
SCOPE_GATEWAY_ONLY
static final java.lang.String SCOPE_GATEWAY_ONLY
- See Also:
- Constant Field Values
-
SCOPE_CLIENT_GATEWAY
static final java.lang.String SCOPE_CLIENT_GATEWAY
- See Also:
- Constant Field Values
-
SCOPE_SESSION
static final java.lang.String SCOPE_SESSION
- See Also:
- Constant Field Values
-
STATUS_SENT
static final java.lang.String STATUS_SENT
- See Also:
- Constant Field Values
-
STATUS_SKIPPED
static final java.lang.String STATUS_SKIPPED
- See Also:
- Constant Field Values
-
-
Method Detail
-
dispatch
java.util.List<java.lang.String> dispatch(java.lang.String project, java.lang.String messageHandler, java.util.Properties filterParams)
Sends a message to a message handler in a project. The message handler can either be in the Gateway, a client, or Perspective session.
You can add optional properties using the filterParams Properties object. For example, to deliver messages to clients that have a user logged in named Bob, you would configure the filterParams like so:
Properties filterParams = new Properties();
filterParams.setProperty(MessageDispatchManager.SCOPE_KEY, MessageDispatchManager.SCOPE_CLIENT_ONLY); filterParams.setProperty(MessageDispatchManager.USER_KEY, "Bob");
If you do not want to pass any filtering properties, just pass in an empty Properties object.- Parameters:
project
- The project name. This value is required.messageHandler
- The message handler name. This value is required.filterParams
- See notes above.- Returns:
- A String List of all the systems that should receive the message, based on the filterParams. This list
can include both clients and the Gateway. This list will NOT contain the recipients forwarded to the
Perspective module. An item in the list is formatted like so:
[type=Client,sessionId=55488AF6,clientAddress=127.0.0.1,clientHostName=localhost,project=SomeProject, messageHandler=MyHandler,filterParams={scope=CG, hostName=localhost}]
-
dispatch
java.util.List<java.lang.String> dispatch(java.lang.String project, java.lang.String messageHandler, org.python.core.PyDictionary messagePayload, java.util.Properties filterParams)
Sends a message to a message handler in a project. The message handler can either be in the Gateway or in a client.
You can add optional properties using the filterParams Properties object. For example, to deliver messages to clients that have a user logged in named Bob, you would configure the filterParams like so:
Properties filterParams = new Properties();
filterParams.setProperty(MessageDispatchManager.SCOPE_KEY, MessageDispatchManager.SCOPE_CLIENT_ONLY); filterParams.setProperty(MessageDispatchManager.USER_KEY, "Bob");
If you do not want to pass any filtering properties, just pass in an empty Properties object.
This version of the function passes a PyDictionary object, which you can add items that can be read by the receiving message handler script.
PyDictionary object example
PyDictionary messagePayload = new PyDictionary(new PyObject[] {new PyString("name"), new PyString("Bob"), new PyString("age"), new PyInteger(31) });
Receiving message handler script (note that the dictionary delivered to the message handler is always called 'messagePayload')
print(messagePayload['name'] # prints "Bob"
- Parameters:
project
- The project name. This value is required.messageHandler
- The message handler name. This value is required.messagePayload
- See notes above.filterParams
- See notes above.- Returns:
- A String List of all the systems that should receive the message, based on the filterParams. This list
can include both clients and the Gateway. An item in the list is formatted like this example:
[type=Client,sessionId=55488AF6,clientAddress=127.0.0.1,clientHostName=localhost,project=SomeProject, messageHandler=MyHandler,filterParams={scope=CG, hostName=localhost}]
-
dispatchRequest
void dispatchRequest(java.lang.String project, java.lang.String messageHandler, org.python.core.PyDictionary messagePayload, java.util.Properties params, MessageResultHandler resultHandler)
Dispatches a "request", which is a message that expects a result. It is expected that the message is handled asynchronously, and the result is communicated back through the result handler.
If the params specifies a remote gateway target, the request will go through the gateway network, otherwise it will be handled locally. Currently requests cannot propagate to clients.- Parameters:
project
- The project name. This value is required.messageHandler
- The message handler name. This value is required.messagePayload
- See notes for dispatch.params
- Similar to parameters on dispatch, but without all of the client filtering properties.resultHandler
- the handler that will receive the success or failure notification.
-
-