This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Drawbacks of using JmsTemplate?

Feb 20th, 2007, 05:22 PM

Hi,

I'm pretty familiar with JMS and its use outside of the Spring Framework. However, I'm looking into using JmsTemplate and had a few questions.

1. If the message producer uses JmsTemplate to create the message, then the consumer uses JmsTemplate to receive the call, will this cause the message producer to block until the consumer returns with a reply? Is there some safeguard on the producer's side to always send the message asynchronously and not have to block? Is there a way to prohibit the consumer from blocking the call?

2. Why can JmsTemplate only be used for synchronous message consumption and not asynchronous consumption? Will there be any future support for asynchronous messages in a Spring template?

1. If the message producer uses JmsTemplate to create the message, then the consumer uses JmsTemplate to receive the call, will this cause the message producer to block until the consumer returns with a reply? Is there some safeguard on the producer's side to always send the message asynchronously and not have to block? Is there a way to prohibit the consumer from blocking the call?

One of the main points of JMS is to decouple producers and consumers from each other in terms of location and time. So a send only blocks until the broker receives it - not until the consumer has processed it.

2. Why can JmsTemplate only be used for synchronous message consumption and not asynchronous consumption? Will there be any future support for asynchronous messages in a Spring template?