I'm setting a scheduled delay for the message, this delay is different per message depending on some logic.
jsmTemplate.convertAndSend(destination, message, (var m) -> {
m.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
return m;
});
When I consume the message I want to retrieve what the delay for the message was. I looked at the values in the TextMessage object but I couldn't see the delay I set. I tried message.getLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
but there's no property with this name. One of my options is just to set another property with the delay m.setLongProperty("messageDelay", delay);
The scheduled message properties are not propagated when scheduled messages are finally sent. If you want to preserve this for some reason then you can simply add your own property to annotate what the original scheduled delay was.
The reason for not propagating the scheduling instruction headers is pretty simple, if the message retained those headers and was bridged to another broker via network or JMS bridge mechanisms they would again be scheduled which is generally not intended. Likewise if the receiving application was to resend without modification the message would again be scheduled. So given the large possibility of unintended consequences the best course of action is for the broker to not retain those headers in the messages as they leave the scheduler.