-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Allow to set TTL (and other QoS-related settings) on a per-message (and/or per-send) basis #26840
Comments
@mauromol I don't understand why you think that what you're asking is any different from #24144 and how Spring Boot is related. What you call a workaround is what the JMS spec mandates, as described in this comment.
I don't really understand what is the problem. Can you clarify what improvements you would like us to consider? |
#24144 was requesting to let the
With Spring Boot you can easily get a These are the solutions (what I call "workarounds") I see:
Of course, copy 'n' paste is always a "solution", but quite inelegant and not future-proof, in case IMHO this requirement is enough reasonable and common (at least when I look at the past issues here on GitHub and at some questions on StackOverflow) to deserve support by I hope I've clarified now. |
In terms of our envisioned scenarios there, it's indeed appropriate to create a per-operation We could make it more obvious/convenient to build such derived With respect to the autoconfigured |
Still, parameters like the delivery mode, the priority and TTL are strictly bound to a message, not to the connection factory IMHO. We're not talking about a connection/socket timeout here, which are properties of the connection. In other messaging systems, these are just message properties (or "headers"), so while providing default values at template level is fine, having to create multiple templates just to be able to specify per-message properties sounds like a waste to me.
Well, perhaps having a method on
It's just more work. After all, we're talking about 3 QoS settings out of ~20 total properties that can be set/configured on a This said, the last decision is up to you of course. |
Yes, but the same argument could be made for any of the 20 properties. The pattern with template is what it is and introducing a builder-style approach could lead other to legitimately request the same to be applied to other properties. I think the building block has to stay as consistent and as simple as possible. |
I do not think so, because I do not think all 20 properties are on the same level, but anyway... I'm just sorry about your final decision. |
Not alone, if it can help in same way :) At least I have some happiness finding other people sharing my mind. I think we can split JmsTemplate usage/settings over several categories:
I think most people setup their JmsTemplate for primary category (infrastructure) and other ones mostly per call. Having default is nice, but duplicating is error-prone as no facilities are provided (clone, overriding wrapper or copy constructor). Can you at least provide some copy facilities ? |
Alright, It's great to get some more feedback here. Reopening to consider our options. |
I know there are at least two other issues on this topic:
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 aJmsTemplate
for you (so the workaround to create a newJmsTemplate
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 theexecute(...)
overloadings that takes aProducerCallback
parameter, however in this case you're completely left alone with regards to the message creation and actual sending process, which is not trivial (seeorg.springframework.jms.core.JmsTemplate.doSend(Session, Destination, MessageCreator)
implementation).The text was updated successfully, but these errors were encountered: