Interface
caplin.services.messaging

MessageService

Provides access to publish/subscriber asynchronous messaging services.

Constructor Summary

Attributes Name and Description
caplin.services.messaging.MessageService()

Method Summary

Attributes Name and Description
void publish(String sSubject, Map mUpdateData, caplin.services.messaging.PublishListener oListener, Map mHints)

Publishes data to a record.

void publishSessionMessage(String sSubject, Map mUpdateData, caplin.services.messaging.PublishListener oListener, Map mHints)

Publishes some session data to a record.

caplin.services.messaging.Subscription subscribe(String sSubject, caplin.services.messaging.SubscriptionListener oListener, Map mHints)

Creates a subscription to a record.

Constructor Detail

caplin.services.messaging.MessageService()

Method Detail

void publish(String sSubject, Map mUpdateData, caplin.services.messaging.PublishListener oListener, Map mHints)

Publishes data to a record.

Parameters
String sSubject The subject of the record being published to.
Map mUpdateData The data to be published to the record.
caplin.services.messaging.PublishListener oListener The listener that will receive the publish events.
Map mHints Any hints that might be used by the concrete implementation of the message service.
See
#subscribe
#publishSessionMessage

void publishSessionMessage(String sSubject, Map mUpdateData, caplin.services.messaging.PublishListener oListener, Map mHints)

Publishes some session data to a record.

Whereas #publish allows you to publish a one-time message for consumption by the server (trade messages are sent like this for example), #publishSessionMessage allows you to publish a message for the duration of your session (the trade-on-behalf-of user is specified like this for example). Session messages are keyed on the subject name, so that if a new message is published on the same subject then we can consider that this replaces the previous message published on that subject.

Message services that support clustering will need to either indicate that these are session messages to the server (for servers that support session replication), or will need to manually republish session messages after fail-over. Message services may also need to republish session messages after reconnection if the server doesn't support session persistence.

Parameters
String sSubject The subject of the record being published to.
Map mUpdateData The data to be published to the record.
caplin.services.messaging.PublishListener oListener The listener that will receive the publish events.
Map mHints Any hints that might be used by the concrete implementation of the message service.
See
#subscribe
#publish

caplin.services.messaging.Subscription subscribe(String sSubject, caplin.services.messaging.SubscriptionListener oListener, Map mHints)

Creates a subscription to a record.

Since hints may or may not be supported by the underlying message service, hints must only used for progressive enhancement. The 'fields' hint, which allows client code to indicate which fields are actually required, is a good example of this. It enables message services that support the hint to reduce the number of fields they subscribe to, yet it wouldn't be disastrous if a message service chose not to support it.

Parameters
String sSubject The subject of the record being subscribed to.
caplin.services.messaging.SubscriptionListener oListener The listener for the subscription.
Map mHints Any hints that might be used by the concrete implementation of the message service.
Returns
The subscription to the record.