4 Replies Latest reply on Oct 27, 2006 11:21 AM by jvroom

    Real Time Data

    jmbnyc74
      I would like to get access to data from a messaging system that is not JMS. I thought that it was possible to create your own Data Service or Data Provider (I saw this in some Adobe Flex 2 manual, but it claimed that the info was in another forthcoming manual). If this is possible where is the info on how to build a non JMS provider.
        • 1. Re: Real Time Data
          aglosband
          I think this section of the livedocs has what you are looking for:

          http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001182.html

          Hope that helps.
          • 2. Re: Real Time Data
            jmbnyc74 Level 1
            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).
            • 3. Re: Real Time Data
              aglosband Level 1
              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;
              msgService.pushMessageToClients(message, true);
              msgService.sendPushMessageFromPeer(message, true);

              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.
              • 4. Re: Real Time Data
                jvroom
                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.