[jboss-user] [EJB 3.0] - JMS TemporaryTopic reply not working

bjwaski do-not-reply at jboss.com
Wed Oct 25 15:20:02 EDT 2006


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);
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980814#3980814

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980814



More information about the jboss-user mailing list