|
|
|
@ -16,6 +16,7 @@
@@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.jms.listener.adapter; |
|
|
|
|
|
|
|
|
|
import javax.jms.BytesMessage; |
|
|
|
|
import javax.jms.Destination; |
|
|
|
|
import javax.jms.InvalidDestinationException; |
|
|
|
|
import javax.jms.JMSException; |
|
|
|
@ -204,9 +205,9 @@ public abstract class AbstractAdaptableMessageListener
@@ -204,9 +205,9 @@ public abstract class AbstractAdaptableMessageListener
|
|
|
|
|
/** |
|
|
|
|
* Extract the message body from the given JMS message. |
|
|
|
|
* @param message the JMS {@code Message} |
|
|
|
|
* @return the content of the message, to be passed into the |
|
|
|
|
* listener method as argument |
|
|
|
|
* @throws MessageConversionException if the message could not be unmarshaled |
|
|
|
|
* @return the content of the message, to be passed into the listener method |
|
|
|
|
* as an argument |
|
|
|
|
* @throws MessageConversionException if the message could not be extracted |
|
|
|
|
*/ |
|
|
|
|
protected Object extractMessage(Message message) { |
|
|
|
|
try { |
|
|
|
@ -396,7 +397,19 @@ public abstract class AbstractAdaptableMessageListener
@@ -396,7 +397,19 @@ public abstract class AbstractAdaptableMessageListener
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected Object extractPayload(Message message) throws JMSException { |
|
|
|
|
return extractMessage(message); |
|
|
|
|
Object payload = extractMessage(message); |
|
|
|
|
if (message instanceof BytesMessage) { |
|
|
|
|
try { |
|
|
|
|
// In case the BytesMessage is going to be received as a user argument:
|
|
|
|
|
// reset it, otherwise it would appear empty to such processing code...
|
|
|
|
|
((BytesMessage) message).reset(); |
|
|
|
|
} |
|
|
|
|
catch (JMSException ex) { |
|
|
|
|
// Continue since the BytesMessage typically won't be used any further.
|
|
|
|
|
logger.debug("Failed to reset BytesMessage after payload extraction", ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return payload; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|