I'm using an MDB as a "server" for my own QueueRequestor (added timeout). Response messages are sent back through temporary queues. Now everything works perfectly as long as I initialize JMS QueueConnection and QueueSession (the ones that use to send response messages back to the requestor) in the ejbCreate method of the MDB and use the same connection and session for all requests that the MDB receives.
// ejbCreate QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx.lookup("java:comp/env/jms/ConnectionFactory"); queueConnection = connectionFactory.createQueueConnection(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueConnection.start();
// send response message method QueueSender responseQueueSender = queueSession.createSender(queue); ObjectMessage objectMessage = queueSession.createObjectMessage(msg); objectMessage.setJMSCorrelationID(correlationID); responseQueueSender.send(queue, objectMessage);