I've read a good thread about JMS and EJB in this group. One messages says "In EJB 1.1 it is perfectly possible to send JMS messages within a session (or entity) bean. It is also possible to SYNCHRONOUSLY receive a JMS message within a bean (receive method on the MessageConsumer called in the bean method)."
My question is: Can we send a message from one method in our bean and then call another method in the bean to wait for return message? (synchronously, of course.)
Any comments are appreciated.
Yes you can use MessageConsumer.receive(), MessageConsumer.receive(long timeout) or MessageConsumer.receiveNoWait() methdos to proactively receive messages, the receiveNoWait() does not block... it returns a Message if one is currently present otherwise returns null. receive() blocks indifinitely or returns null if the session is closed while it's blocked, receive(long) returna a Message if one is received before it times out otherwise returns null