I am trying to set the expiration of a message in the Blueprint XML Camel route. The value that I want to set as expiration is stored inside the message body ( protobuf ).
Here is my code: -
<setHeader headerName="AMQ_SCHEDULED_DELAY"> <method bean="NotificationScheduler" method="postponeSending" /> </setHeader> <setHeader headerName="JMSExpiration"> <method bean="NotificationScheduler" method="getExpiry" /> </setHeader> <setHeader headerName="ExpirationTest"> <method bean="NotificationScheduler" method="getExpiry" /> </setHeader> <to uri="activemq:notifications.splitter" />
As you can see in the screenshot below, I successfully set two of the three headers, but the setting for "JMSExpiration" (according to this topic ) has no effect.

I know that, as an alternative, I could use a recipient list template for dynamically dialing uri - that is, extract expiration from the message data and add the parameter ?timeToLive=... However, this seems a little awkward to me.
Is there a way to set expiration via setHeader in XML?
Thanks,
J.
source share