Announcement Announcement Module
No announcement yet.
how to map sync EJB call to async JMS req/resp pair Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to map sync EJB call to async JMS req/resp pair


    Basically, we have the situation our session bean synchronous
    call map to asynchronous JMS messages.
    In other words, a session bean method call would have the
    following implementation logic:
    1. marshall params and send async JMS message.
    2. wait around for a reply message to be ready
    3. receive a reply JMS message, unmarshall response.
    4. return.
    The problem, clearly, is that we can't do step 2 in the EJB method itself for fear
    of tying up threads.

    I use JMSTemplate to send and receive (block with timeout and select on correlationid)

    This seems like a classic problem of mapping synchronous EJB calls to asynchronous

    Any suggestions how to do this?


  • #2
    This may be a silly and late response, but why aren't you using Message Driven Beans?


    • #3
      The alternative is to create a local object which sends the message to JMS and does a receive, typing up the thread on the client side, not the server side.

      Ultimately all synchronous calls are asynchronous with some sort of waiting in the middle. It just depends where you want to put the wait. If you were to call a database directly from an EJB using the underlying database API would have to submit an asynchronous call and then some sort of wait tying up the thread.

      I imagine you want to use JMS to make you application more scalable on the server side. For this you need to make your client side either more complicated or consume more resources.