best way to make an asynchronous with out JMS


EJB programming & troubleshooting: best way to make an asynchronous with out JMS

  1. best way to make an asynchronous with out JMS (4 messages)

    I am interested to know if there are any patterns or techniques which allows a client to make an asynchronous call to its server. I don't want to use JMS and any third party api's

    Threaded Messages (4)

  2. Here is a common trick:

    1. Make a synchronous call to a server-side process.

    2. Spawn a new thread in the server process to handle the request.

    3. Have the server method return immediately after spawning the thread.

    This is effectively asynchronous.
  3. Threads in the server?[ Go to top ]

    I thought that it was a no no to create your own threads in the server?

    JMS is the only way that I have ever seen the ability to create an asynch request. Is there a reason that you do not wish to use JMS? JMS offers some nice features and just think if the processing of these asynch messages is too much of a load on your server you can easily off load it to another server by using something like a message bridge.

  4. Threads in the server?[ Go to top ]

    Only the EJB standard explicitly prohibits the creation of new threads. It is fine to great new threads in a servlet or web service. (though you should use something like a thread pool for greatest effeciency).

    Even with EJBs, you can spawn new threads, provided that you are very careful, although it is technically a violation of the EJB-specification.
  5. Not sure why you don't want to use JMS. But you could implement the Observer pattern and do essentially what the previous response mentioned.