Announcement Announcement Module
No announcement yet.
JmsOperations send+receive Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JmsOperations send+receive

    I want to make a "synchronous" call with JMS.
    final MessageProducer producer = session.createProducer(destination);
    final TemporaryQueue queue=session.createTemporaryQueue();
    final MessageConsumer consumer=session.createConsumer(queue);
    final ObjectMessage message=session.createObjectMessage(data);
    final Message result=consumer.receive();
    I am using temporary queue, so I have to use send and receive in a single JMS session. I don't see any appropriate method in JmsOperations to do it. receive methods don't allow send a message, and send methods don't "open" session, so it doesn't listen for incoming.
    What's better way to do it?
    If I don't use JmsOperations I have to implement a lot of code to support Destination Resolvers, default destination, wrapping resources in try-finally, etc.

  • #2
    There is a JIRA issue for adding this functionality to JmsTemplate:

    We do provide that support in Spring Integration where there is a JMS "outbound-gateway" (gateway being request/reply). However, I assume you don't want to depend on that project just for this feature? (It might give you an idea of how to implement it in the meantime... if you check the source)