0 Replies Latest reply on May 27, 2009 8:44 PM by Jon Hatfield

    JMS receiving acknowledgments

    Jon Hatfield Newbie


      I have a SFSB with a QueueSender that sends messages to a Message Driven Bean. The onMessage() method in the MDB is receiving them. However, I cannot find a way to communicate an acknowledgement back to the SFSB (or any other bean). Here are what I think could be possibly ways to do this:

      1. A lookup of the calling SFSB instance to call a simple acknowledgement method - this does not work, as even when this method is marked as a @Factory method, the whole SFSB is re-initialized, causing an infinite loop. This is presumably due to an init() method marked with @Create in the SFSB, though the SFSB is of course already created so I would not expect this to run again, and I am also unsure if this can even work as I have read that MDBs can not even access the conversational state of the caller? (As far as I know, ejb @Stateful defaults to Seam @Converational).

      2. A lookup of a helper bean - if this helper bean is not converational, I get a no long-running converation exception, and if it is, and initiated elsewhere before being called (as I have seen that MBDs cannot initiate a conversation themselves) I get stack must not be null.

      3. Use a QueueReceiver object in the SFSB, which I believe must be bound to the MDB. This looks to involve injecting the MDB into the SFSB, though I am not clear how the QueueReceiver object knows when the onMessage method has finished running i.e. done and ready to acknowledge completion back to the caller.

      This application works by having SFSBs that propagate a conversation and often use the @create annotation to initialise themselves on each page request. Ultimately what I am trying to do is have a set of methods in a SFSB that can be called simultaneously by different threads to save time.

      I would be very grateful for any help.
      Thanks very much,

      ps I am using the Lifecycle class to allow the MDB to gain access to Seam contexts