4 Replies Latest reply on Nov 8, 2009 11:27 PM by Mr Dejan

    FMS and Java servlet

    Mr Dejan Level 1



      Is there any way to connect Java servlet to FMS?

      I would like to send comand from servlet via HTTP to FMS?

      (Something like communication to Flash media server using administration API)


      The best way for me would be connecting (writing) to SharedObjects, but I would be happy with any connection at all.


      (I read some about ColdFusion, but there would be too much modification on my servlet.)


      There must be some simple way, but I just can't figure it out.


      Some help would be appreciated. Thank you.


        • 1. Re: FMS and Java servlet
          JayCharles Level 4

          Depending on your needs, you may be able to use the broadcastMsg method of the admin service API.


          If you need to get data back from an FMS application instance, you'll need the application instance to initiate requests to your servlet. FMS can't listen for and process HTTP requests, other than to proxy them to an HTTP server.


          If you can describe the required interaction between the servlet and the FMS app, perhaps I can offer more advice.

          1 person found this helpful
          • 2. Re: FMS and Java servlet
            Mr Dejan Level 1

            Thank you very much for your answer.


            We were thinking about broadcastMsg method of the service admin API, but we don't know if this is optimal solution in our case.


            What we need is some kind of ability to write from our system (java+servlet) via HTTP to FMS's shared objects. After data is stored in objects, clients are invoked by onSync function.


            On the way back (communication from client -->FMS-->system) we also need optimal solution for interaction between FMS and the system.



            I also attached  RSiTV.pdf file in which I described the topology of the system.


            Thank you again for all your solutions.





            • 3. Re: FMS and Java servlet
              JayCharles Level 4

              Does  your servlet architecture allow you to listen for connections on the java side and maintain stateful socket connections, or is it HTTP GET/POST only? Although FMS can't listen for connections other than RTMP, it can initiate a stateful connection with another service.


              It seems to me that the optimal solution would be to have the FMS application open a socket connection to the servlet onAppStart (see the XMLSocket class in the server side actionscript docs). If the servlet doesn't support it, it might make better sense to refacor the servlet. Otherwise, you may be stuck with something like this:


              1. Servlet invokes broadcastMsg on the admin service

              2. The servlet gets a nondescriptive success/error result.

              3. Admin service dispatches the message to the FMS application

              4. The FMS application updates the shared object (you'd handle this in your server side AS).

              5. somewhere in the data the serlet sent, there will be data the FMS app needs to send a message back to the servlet (url, whatever)

              6. The FMS app makes an http request of the servlet, and sends whatever data you need sent.


              That's a lot of processing for updating some values in a shared object, and since you mentioned there will be a lot of these events happening, it might be a strain on the admin system (and might pose serious challenges if/when you need to scale the application).

              • 4. Re: FMS and Java servlet
                Mr Dejan Level 1

                Thank you for the excellent advice - sockets.


                Thank you again, have a nice day.