|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectflex.management.ManageableComponent
flex.messaging.services.ServiceAdapter
flex.messaging.services.messaging.adapters.MessagingAdapter
public abstract class MessagingAdapter
Base adapter class for publish/subscribe messaging adapters. You extend this class if you want to implement your own messaging adapter. A custom messaging adapter has the ability to implement authorization logic for specific subtopics, and may also control how messages are routed. A more advanced messaging adapter can take control over the subscription process and have complete control over the subscription process for producers and consumers.
All messaging adapters must provide an implementation for the invoke method. A simple invoke implementation which would give you similar functionality as the ActionScriptAdapter is simply:
public Object invoke(Message message)
{
MessageService msgService = (MessageService)service;
msgService.pushMessageToClients(message, true);
msgService.sendPushMessageFromPeer(message, true);
return null;
}
This method is called for each data message sent from the client. It gets a reference to the MessageService which is controlling delivery of messages for this adapter. It uses the pushMessageToClients method to send the message to all clients connected to this server. It then uses the sendPushMessageFromPeer method to send the message to other servers which will then route the message to each client connected to those servers. In both cases, we pass the "evalSelector" parameter as true. This indicates that the message service will only send the message to those clients whose selector pattern evaluates to true for the supplied message. If you supply false, the selector pattern is ignored and the message is delivered to the clients even if the pattern evaluates to false.
The default behavior is for the messaging adapter to use the builtin FDS subscription mechanism. The client sends subscribe and unsubscribe command messages which are managed by the MessageService, not the adapter. If you override the "handlesSubscriptions" method to return true, your adapter's manage method is called for each of these command messages instead. You must then override this method to provide an implementation for these operations. See the docs on the CommandMessage class for details on the message format.
ServiceAdapter,
MessageService,
Message,
CommandMessage| Field Summary |
|---|
| Fields inherited from class flex.messaging.services.ServiceAdapter |
|---|
LOG_CATEGORY |
| Constructor Summary | |
|---|---|
MessagingAdapter()
Constructs an unmanaged MessagingAdapter instance. |
|
MessagingAdapter(boolean enableManagement)
Constructs a MessagingAdapter instance. |
|
| Method Summary | |
|---|---|
boolean |
allowSend(Subtopic subtopic)
Implements flex.messaging.security.MessagingSecurity. |
boolean |
allowSubscribe(Subtopic subtopic)
Implements flex.messaging.security.MessagingSecurity. |
MessagingSecurityConstraintManager |
getSecurityConstraintManager()
Gets the MessagingSecurityConstraintManager of the MessagingAdapter. |
void |
initialize(String id,
ConfigMap properties)
Initializes the MessagingAdapter with the properties. |
void |
setSecurityConstraintManager(MessagingSecurityConstraintManager constraintManager)
Sets the MessagingSecurityConstraintManager of the MessagingAdapter. |
| Methods inherited from class flex.messaging.services.ServiceAdapter |
|---|
getAdapterState, getDestination, handlesSubscriptions, invoke, manage, setAdapterState, setDestination, start, stop |
| Methods inherited from class flex.management.ManageableComponent |
|---|
getControl, getId, getParent, isManaged, isStarted, isValid, setControl, setId, setManaged, setParent |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MessagingAdapter()
MessagingAdapter instance.
public MessagingAdapter(boolean enableManagement)
MessagingAdapter instance.
enableManagement - true if the MessagingAdapter
has a corresponding MBean control for management; otherwise false.| Method Detail |
|---|
public void initialize(String id,
ConfigMap properties)
MessagingAdapter with the properties.
Subclasses should call super.initialize.
initialize in interface FlexConfigurableinitialize in class ManageableComponentid - Id of the MessagingAdapter.properties - Properties for the MessagingAdapter.public boolean allowSubscribe(Subtopic subtopic)
FlexContext.getUserPrincipal().
allowSubscribe in interface MessagingSecuritysubtopic - The subtopic the client is attempting to subscribe to.
public boolean allowSend(Subtopic subtopic)
FlexContext.getUserPrincipal().
allowSend in interface MessagingSecuritysubtopic - The subtopic the client is attempting to send a message to.
public MessagingSecurityConstraintManager getSecurityConstraintManager()
MessagingSecurityConstraintManager of the MessagingAdapter.
MessagingSecurityConstraintManager of the MessagingAdapter.public void setSecurityConstraintManager(MessagingSecurityConstraintManager constraintManager)
MessagingSecurityConstraintManager of the MessagingAdapter.
constraintManager - The MessagingSecurityConstraintManager of the MessagingAdapter.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/services/messaging/adapters/MessagingAdapter.html