Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS - TemporaryQueue - unable to receive reply from consumer application  RSS feed

christopher kai
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have tried to implement synchronous messaging, using Spring and JMSTemplate. The producer is executing session callback as follows:

SessionCallback sck = new SessionCallback() {

public Object doInJms(Session session) {
Map map = new HashMap();
map.put(..parameters go here..);

try {
Message msg = jmsTemplate.getMessageConverter().toMessage(map, session);
MessageProducer prod = session.createProducer(jmsTemplate.getDefaultDestination());
TemporaryQueue tq = session.createTemporaryQueue();

MessageConsumer mc = session.createConsumer(tq);

Message reply = mc.receive();
Map replyMap = (Map)jmsTemplate.getMessageConverter().fromMessage(reply);

String result = (String)replyMap.get("result");
return result;

catch (JMSException e ) {
return "JMS_ERROR";



On the other application, there is a listener implementing Spring's SessionAwareMessageListener with onMessage() containing:

public void onMessage(Message message, Session session) throws JMSException {

MessageProducer prod = session.createProducer(message.getJMSReplyTo());
Map map2 = new HashMap();
map2.put("result", "OK");
Message reply = messageConverter.toMessage(map2, session);


The message is sent to the other application (using administratively created queue), the reply is sent on the remote app but never comes back to calling app. It is running on Sun Appsrv 9 and IMQ. Why is that?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!