Discussions

General J2EE: Servlet to JMS then back to Servlet

  1. Servlet to JMS then back to Servlet (11 messages)

    I am considering a re-design of existing application. Other systems interact to this application by posting the request thru the servlet and servlet sends the request back. If i have to design in such a way that Servlet accepts the request and put it on a JMS queue,then it gets processed.Now my concern is how do i send the response back to the requesting client. At this point of time requesting client cannot modify there interface so can't expect them to implement a call back.
    Any ideas on this would be appriceated.

    Thanks
    Somil

    Threaded Messages (11)

  2. Servlet to JMS then back to Servlet[ Go to top ]

    If i have to design in such a way that Servlet accepts the request and put it on a JMS queue,then it gets processed.Now my concern is how do i send the response back to the requesting client. At this point of time requesting client cannot modify there interface so can't expect them to implement a call back.Any ideas on this would be appriceated.ThanksSomil
    Somil,
    You can write a simple applet that would be a MessageListener. The applet could do proccessing, notify the JMS queue itself, and then start listening for a response on a "response" Topic.
  3. Asynchronous response[ Go to top ]

    Are you thinking of asynchronous response? If yes, then you can notify the user to check the status later.

    And your Message Driven bean can do its work and update the status in a DB.
  4. Asynchronous response[ Go to top ]

    Hi,
    Or simpler thanteh applet, ahve apage with an expiartion time header (for example 5 seconds) that periodically chceks if the server finished it's asynchronous processing (through JMS)

    best regards, Mircea
  5. Asynchronous response[ Go to top ]

    Hi,Or simpler thanteh applet, ahve apage with an expiartion time header (for example 5 seconds) that periodically chceks if the server finished it's asynchronous processing (through JMS)best regards, Mircea

    In that case i hav eto wait min for 5 secs to send the response back ...thats not acceptable ..becuase in some cases the response can be sent back in 2-3 secs ..but if we go with this desing min time to sent back the response is set to 5 secs
  6. Asynchronous response[ Go to top ]

    JMS can be synchronous too...Rite? Make your call from Servlet to JMS synchronus..
  7. Asynchronous response[ Go to top ]

    The whole purpose of redesign is to make it asychronous, so can't use synchronous messaging
  8. I have a similar problem...[ Go to top ]

    I have investigated the pushlets (and streamlets from ActiveMQ - http://activemq.codehaus.org/) route, but my understanding is that it works only for applications where the same data is pushed to the subscriber (the servlet).

    What I need is for the client (a servlet) to capture search form data and publish it to a JMS topic, where multiple Subscribers use that same form input to retrieve data from various external parties, then return that data back to the client in an asychronous nature.

    So far my solution is to pass a unique identifier for each search in the message and then have a listener waiting to deal with all the responses from the Subscribers, storing the returned data in a hash keyed on the unique identifier and the client servlet is constantly looking up that hash until all the data is retrieved. Any thoughts on this?

    Another solution that has been bandied around is that in the original message, a reference to the original servlet is passed, so that, when the Subscriber has retrieved its data it calls back on some method on the servlet to update it? Will this work? If so, how do you do that?
  9. Asynchronous response[ Go to top ]

    Are you thinking of asynchronous response? If yes, then you can notify the user to check the status later.And your Message Driven bean can do its work and update the status in a DB.

    The response has to be synchronous. Thats another application which has to wait for the response back from us to go further.
  10. Servlet to JMS then back to Servlet[ Go to top ]

    If i have to design in such a way that Servlet accepts the request and put it on a JMS queue,then it gets processed.Now my concern is how do i send the response back to the requesting client. At this point of time requesting client cannot modify there interface so can't expect them to implement a call back.Any ideas on this would be appriceated.ThanksSomil
    Somil,You can write a simple applet that would be a MessageListener. The applet could do proccessing, notify the JMS queue itself, and then start listening for a response on a "response" Topic.
    The number of request will be around 100 request per min.
    So if i go with a listerner waiting for responses on the response queue ..i am not sure how its gonna perform. Also its not possible to use an applet
  11. Pushlets[ Go to top ]

    I suggest you to try pushlets:
     http://www.pushlets.com/
  12. Hi, I don't know what kind of application server you are using. If you choose WebLogic, that's will be easier to implement. You can wrap your servlet into WebServices, and WebLogic support callback function to implement asynchronous invocation. You can check the detail from bea's website.

    Danny