flex.messaging.services
Class MessageService

java.lang.Object
  extended byflex.management.ManageableComponent
      extended byflex.messaging.services.AbstractService
          extended byflex.messaging.services.MessageService
All Implemented Interfaces:
Manageable, flex.messaging.services.messaging.MessagingConstants, Service

public class MessageService
extends flex.messaging.services.AbstractService
implements flex.messaging.services.messaging.MessagingConstants

The MessageService class is the Service implementation that manages point-to-point and publish-subscribe messaging.


Field Summary
static String LOG_CATEGORY
          The log category for messages logged out by the MessageService.
 
Fields inherited from class flex.messaging.services.AbstractService
broker, destinations, settings, supportedMessageTypes
 
Fields inherited from interface flex.messaging.services.messaging.MessagingConstants
ALLOW_SUBTOPICS_ELEMENT, BATCH_WRITE_SIZE_ELEMENT, DEFAULT_DURABLE_STORE, DEFAULT_MAX_CACHE_SIZE, DEFAULT_SUBTOPIC_SEPARATOR, DURABLE_STORE_TYPE_ELEMENT, IS_DURABLE_ELEMENT, MAX_CACHE_SIZE_ELEMENT, SUBTOPIC_SEPARATOR_ELEMENT, TIME_TO_LIVE_ELEMENT
 
Method Summary
protected  void incrementMessageCount(boolean commandMessage)
          Used to increment the message count metric for the MessageService.
protected  Message manageSubscriptions(CommandMessage command, boolean useAdapter)
          Processes subscription related CommandMessages.
 void pushMessageToClients(Message message, boolean evalSelector)
          Pushes a message to all clients that are subscribed to the destination targeted by this message.
 void pushMessageToClients(Set subscriberIds, Message message, boolean evalSelector)
          This method is not invoked across a cluster, it is always locally invoked.
 void sendPushMessageFromPeer(Message message, boolean evalSelector)
          This method sends the passed message to clients connected to other server peer nodes in the cluster.
 void serviceMessageFromAdapter(Message message, boolean sendToAllSubscribers)
          This method is called from a messaging adapter to handle the delivery of messages to one or more clients.
protected  void setupServiceControl(MessageBroker broker)
          This method is invoked to allow the MessageService to instantiate and register its MBean control.
 
Methods inherited from class flex.messaging.services.AbstractService
createDestination, createDestinations, getDestination, getDestinationByName, getId, getMessageBroker, getSettings, isSupportedMessage, isSupportedMessageType, serviceCommand, serviceCommonCommands, serviceMessage, setId, start, stop
 
Methods inherited from class flex.management.ManageableComponent
getControl, isManaged, setControl, setManaged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface flex.management.Manageable
getControl, isManaged, setControl, setManaged
 

Field Detail

LOG_CATEGORY

public static final String LOG_CATEGORY
The log category for messages logged out by the MessageService.

See Also:
Constant Field Values
Method Detail

serviceMessageFromAdapter

public void serviceMessageFromAdapter(Message message,
                                      boolean sendToAllSubscribers)
This method is called from a messaging adapter to handle the delivery of messages to one or more clients. If you pass in the sendToAllSubscribers parameter as true, the message is routed to all clients who are subscribed to receive messages from this destination. When you use this method, the selector expressions for all subscribing clients are not evaluated. If you want the selector expressions to be evaluated, use a combination of the pushMessageToClients method and the sendPushMessageFromPeer methods.

Parameters:
message - The Message to send.
sendToAllSubscribers - If true, send this message to all clients subscribed to the destination of this message. If false, send the message only to the clientId specified in the message.

sendPushMessageFromPeer

public void sendPushMessageFromPeer(Message message,
                                    boolean evalSelector)
This method sends the passed message to clients connected to other server peer nodes in the cluster.

Parameters:
message - The Message to push to peer server nodes in the cluster.
evalSelector - true to evaluate each remote subscriber's selector before pushing the message to them; false to skip selector evaluation.

pushMessageToClients

public void pushMessageToClients(Message message,
                                 boolean evalSelector)
Pushes a message to all clients that are subscribed to the destination targeted by this message.

Parameters:
message - The Message to push to the destination's subscribers.
evalSelector - true to evaluate each subscriber's selector before pushing the message to them; false to skip selector evaluation.

pushMessageToClients

public void pushMessageToClients(Set subscriberIds,
                                 Message message,
                                 boolean evalSelector)
This method is not invoked across a cluster, it is always locally invoked. The passed message will be pushed to the subscribers in the passed set, conditionally depending upon the execution of their selector expressions.

Parameters:
subscriberIds - The set of subscribers to push the message to.
message - The Message to push.
evalSelector - true to evaluate each subscriber's selector before pushing the message to them; false to skip selector evaluation.

incrementMessageCount

protected void incrementMessageCount(boolean commandMessage)
Used to increment the message count metric for the MessageService. This value is stored in the corresponding MBean. The MessageService already invokes this method in its serviceMessage() and serviceCommand() implementations, but it a subclass overrides these methods completely it should invoke this method appropriately as it processes messages.

Parameters:
commandMessage - Pass true if the message being processed is a CommandMessage; otherwise false.

manageSubscriptions

protected Message manageSubscriptions(CommandMessage command,
                                      boolean useAdapter)
Processes subscription related CommandMessages. Subclasses that perform additional custom subscription management should invoke super.manageSubscriptions() if they choose to override this method.

Parameters:
command - The CommandMessage to process.
useAdapter - true if the destination's adapter manages subscriptions; otherwise false.
Returns:
The Message result for the passed CommandMessage.

setupServiceControl

protected void setupServiceControl(MessageBroker broker)
This method is invoked to allow the MessageService to instantiate and register its MBean control.

Parameters:
broker - The MessageBroker to pass to the MessageServiceControl constructor.


Copyright © 2006 Adobe Systems Inc. All Rights Reserved. (Updated August 2, 2006)

Take a survey