Description
I know there are at least two other issues on this topic:
- JMSTemplate should support setting QoS settings on send [SPR-5183] #9856 describes the requirement and the context precisely; however it is very old and was closed in a bulk update
- JmsTemplate ignoring TTL on message level #24144 was closed because the request was probably asking for this feature in the wrong way, i.e. by violating the (objectively confusing) JMS API
With this I'm asking if you could reconsider to improve JmsTemplate
so that it's possible to do this, especially in light of the existence now of Spring Boot, which configures a JmsTemplate
for you (so the workaround to create a new JmsTemplate
instance on each message send makes things much more complex than they could be).
Use case: I'm using JmsTemplate
to send notifications; these notifications should have different expiration times depending on their context, which has itself an expiration after which all related notifications become stale and useless.
To workaround this, apart from the option to create new JmsTemplates
on each send operation, there's the possibility to use one of the execute(...)
overloadings that takes a ProducerCallback
parameter, however in this case you're completely left alone with regards to the message creation and actual sending process, which is not trivial (see org.springframework.jms.core.JmsTemplate.doSend(Session, Destination, MessageCreator)
implementation).