|
||||||||||
| 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.
flex.messaging.ServiceAdapter,
MessageService,
Message,
CommandMessage| Field Summary |
|---|
| Fields inherited from class flex.messaging.services.ServiceAdapter |
|---|
LOG_CATEGORY |
| Constructor Summary | |
|---|---|
MessagingAdapter()
|
|
| Method Summary | |
|---|---|
boolean |
allowSend(Subtopic subtopic)
This method is invoked before a client message is sent to a subtopic, so that custom application logic can determine whether the client should be allowed to send to the specified subtopic. |
boolean |
allowSubscribe(Subtopic subtopic)
This method is invoked before a client subscribe request is processed, so that custom application logic can determine whether the client should be allowed to subscribe to the specified subtopic. |
| 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, initialize, 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()
| Method Detail |
|---|
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.
|
||||||||||
| 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/livecycle/es/sdkHelp/programmer/lcdsjavadoc/flex/messaging/services/messaging/adapters/MessagingAdapter.html