I have some code that sends a message (pub/sub) to an MDB, and then uses a TemporaryTopic to try to get a response. The MDB gets the request and publishes a response within a second or so, but it never gets to the client. Any suggestions would be great. Here's my code:
InitialContext ctx = new InitialContext(JNDI_PROPERTIES); ConnectionFactory cf1 = (ConnectionFactory)ctx.lookup("ConnectionFactory"); Topic pTopic = (Topic)ctx.lookup(TOPIC_NAME); Connection con1 = cf1.createConnection(); Session pubSession1 = con1.createSession(false, Session.AUTO_ACKNOWLEDGE); TemporaryTopic replyTopic1 = pubSession1.createTemporaryTopic(); Session subSession1 = con1.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer1 = subSession1.createConsumer(replyTopic1); con1.start(); MessageProducer producer1 = pubSession1.createProducer(pTopic); MapMessage msg = pubSession1.createMapMessage(); for(Map.Entry<String, String> entry: message.entrySet()) { msg.setString(entry.getKey(), entry.getValue()); } msg.setStringProperty(MessagingUtil.SERVICE_NAME, serviceName); logger.info("replyTopic1: " + replyTopic1); msg.setJMSReplyTo(replyTopic1); producer1.send(msg); Message reply = consumer1.receive(7500); logger.info("response: " + reply);