jcb
jcb

Reputation: 195

Can I get JMSXDeliveryCount and JMSDestination using org.springframework.messaging.Message

I am using Spring JMS 4.1.2, and I am using org.springframework.messaging.Message as the input payload in the JMS Listener. I am listening to an Active MQ Queue, and I would like to know if it is possible to obtain the JMSXDeliveryCount and JMSDestination using the org.springframework.messaging.Message, or if I have to use the javax.jms.Message class to accomplish this.

Thanks,

Juan

Upvotes: 0

Views: 1549

Answers (1)

Gary Russell
Gary Russell

Reputation: 174729

The delivery count property is mapped by default; I just ran a test...

message: GenericMessage [payload=jms test, headers={jms_redelivered=true, JMSXDeliveryCount=2, ...

Standard headers are mapped with a jms_ prefix all; message properties are mapped as-is.

The destination from which the message is received is not currently mapped to the message.

You would need to add a custom JmsHeaderMapper - perhaps a subclass of DefaultJmsHeaderMapper.

I opened a JIRA issue to make this standard.

Upvotes: 1

Related Questions