There was a subtle change in the Spring JmsTemplate between 2.0.7 and 2.5.x that caused the issues observed with a Null Message being returned on a receive() [waiting forever for a Message]. The change made seems to be related to making the Spring JmsTemplate more compliant with the JMS standard. The change made was related to the value used to indicate a blocking[WAIT] receive() timeout value call, in 2.0.7 that value was a '-1', in 2.5.4 it is now a '0'.... This subtle change caused me to become a client of the hair-club, since I had ripped out large sections while debugging this nasty side-effect..
All is well now...
Spring JmsTemplate 2.0.7 code:
Code:
public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations {
/**
* Default timeout for receive operations:
* -1 indicates a blocking receive without timeout.
*/
public static final long DEFAULT_RECEIVE_TIMEOUT = -1;
Spring JmsTemplate 2.5.4 code:
Code:
public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations {
/**
* Timeout value indicating that a receive operation should
* check if a message is immediately available without blocking.
*/
public static final long RECEIVE_TIMEOUT_NO_WAIT = -1;
/**
* Timeout value indicating a blocking receive without timeout.
*/
public static final long RECEIVE_TIMEOUT_INDEFINITE_WAIT = 0;