Asynchronous processing


EJB design: Asynchronous processing

  1. Asynchronous processing (3 messages)

    Hello all,
    Here's a question:
    I have a session EJB that performs communication and processing with a legacy system. This processing can take an unknow time to complete. Given this, the EJB client is a MDB A, which consumes an message and initiates the processing in the EJB, allowing the client to do other tasks meanwhile.
    The problem is that the clients needs to know time in time the processing status of EJB. I though using another MDB B and the EJB sending messages informing its status to a queue in order to the MDB B consumes it. But, how do I send that received messages by the MDB B to the correct client?


    Threaded Messages (3)

  2. Ugh[ Go to top ]

    If you need to message to be sent to a client, I would say an MDB was a poor implementation choice for the service.

    Use a service implementation that can make client callbacks, such as a Session Bean.
  3. Ugh[ Go to top ]

    What do you mean with that?
  4. Er[ Go to top ]

    I just meant that if you use MDB, you achieve asynchronicity but at the cost losing your references to the client. So making event-based calls to the client becomes hard.

    If you use old-fashioned java threads to achieve asynchronicity, it allows you to do callbacks - see the Observer design pattern.