-
Notifications
You must be signed in to change notification settings - Fork 38.5k
JmsTemplate ignoring TTL on message level #24144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Had the same issue with it. This would help a lot really strange that you can't set TTL on message level, only on JMSTemplate level. |
Nicely spotted! |
Quoting its javadoc: "This method is for use by JMS providers only to set this field when a message is sent. This message cannot be used by clients to configure the expiration time of the message." |
I suppose we could try to detect pre-populated |
Like this?
|
Indeed, if we do this it would be along those lines, also covering |
FWIW, we would preferably keep using the overloaded |
Sure. MessageProducer has explicit API to be called with TTL |
That API is what we're using in "explicitQosEnabled" already, mostly for the aforementioned provider pooling impact, so we'd simply like to preserve that part. What I meant is that the only use case for this proposal is user code that pre-populates the message header through Am I missing something? Is there a specific JMS provider that suggests such pre-populated expiration headers and documents it as officially supported? |
As example of such work - ActiveMQ implementation of JMS API. It basicly ignores message TTL cause using defaults from MessageProducer API. And it allows to set some very specific headers like delivery mode, priority or TTL. |
I'm curious about use cases here. So where specifically would you set a time-to-live value at the message level when using it with |
We do it per message in |
After some further research, I still haven't found any indication that such a user-level ActiveMQ does not seem to respect a This issue title makes it sound like a |
Yes - as a JmsTemplate feature. It is widely used to communicate with JMS thus adopting such behavior would be friendly for framework users. It could be enabled per configuration. In later releases it could be removed as Brokers would introduce such behavior ( as it is in RabbitMQ) |
While I agree that part of the spec/api is confusing and has tripped numerous users, The javadoc is very specific and I am not keen to ignore it. It would also be weird that JmsTemplate would do something that all other compliant JMS clients wouldn’t. |
@snicoll does it mean that JmsTemplate should rely on |
The |
So there is now way with Spring set TTL per message only per template? In other case should integrate with JMS broker bypassing Spring? |
I think we're running a little bit in circles here. We've already answered this question in a number of different ways. I don't think bypassing Spring is going to give you much as you'd have to call the I understand you'd like us to do something about it but unfortunately we can't as the spec is very clear on that front. |
From my perspective, I would only really revisit our arrangement in Since regular JMS |
Affects: 5.1.x
On sending message to JMS expiration header is ignored by JmsTemplate. TTL may be set per message -
Message.setJMSExpiration(long expiration)
. For now JmsTesmpate support expiration of message per producer - any message level TTL is ignoredSuggestion: resolve TTL of message in following way:
Current
JmsTemplate
implementation checks for 2 ignoring message level.Example of fix:
PR could be created and provided.
The text was updated successfully, but these errors were encountered: