This content has been marked as final. Show 4 replies
I think this section of the livedocs has what you are looking for:
Hope that helps.
Thanks. That is close, but not exactly. What I want to do is establish communication (from a flex 2 app) with a backend messaging service (the API is SOAP, so no problem sending to it). However, I want to get async callbacks when events arrive from the messaging service. It is not clear from the doc (perhaps I need to read the java docs more thoroughly) how the invoke method is called (from where and when).
Hi. The invoke method is called by the flex messaging system (I believe by the message broker) when a message is received from a flex client. This is where I think you would call into your backend messaging service. You would then need to have a method setup to receive the async callbacks from your messaging service and it is here that you would push the messages back out to your flex clients using what's shown in the invoke method in the doc.
MessageService msgService = (MessageService)service;
Does that make sense? Also, in the example from doc, the service object that is used is defined in the ServiceAdapter class which your custom adapter class will inherit from. I'm not sure if that was clear.
The code that Alex shows is what you would use if you write a custom MessageAdapter. That allows you to process messages sent from the client and alter the way in which those messages are handled. In your case though, it sounds like you simply need to push messages to clients by routing them from some other message source. In this case, you can have your clients subscribe to particular destinations with/without subtopics or selectors as needed to control the routing. Then use the MessageBroker api on the server to send these messages to the proper clients. See the Feed.java file which is in the samples WAR file WEB-INF/src/samples/dashboard/Feed.java.