-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Provide a configuration property for JMS listener container's receive timeout #17332
Conversation
@ibmmqmet Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
Thanks for the proposal. Given that we have separate properties for the template and the listener, users may be surprised that a
1 provides more flexibility whereas 2 makes it easier to keep the two in sync. I don't have a strong opinion about which is the better option, although I am leaning towards 1. What do you think, @ibmmqmet. @snicoll will probably have an opinion too once he's back in the office. |
The template seemed to be being used for quite a few other properties, but it's not clear what the real distinction is - it does have that receiveTimeout property inside the JMSProperties.Template class, which is not used elsewhere that I could see - so doing it this way made sense. What's the point of having the property in the class otherwise. And it is configurable into the template, just not propagated. Maybe there's a philosophy around what belongs in a "template" and what belongs in the a "real" created object. I don't know why you'd treat a JMS Listener differently than a Destination/Connection for default properties, but if there's a preferred way of doing it, then I don't really care. Of your two options (1) is probably easiest to understand. |
Lines 85 to 96 in aef92b9
It sounds like you weren't aware of Spring Framework's In short:
In light of the above, is your preference still for the first of the two options that I proposed? |
To associate your GitHub account with IBM's corporate CLA it needs to be a public member of the IBM or OpenLiberty GitHub organisations. There is a little more about this in the CLA tool's FAQ. |
Yes, a separate property as in (1) would work. |
Would you like to update your proposal to that effect? |
@ibmmqmet Thanks for the updates. Can you please make the necessary changes to have your GitHub account associated with IBM's CLA? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Would you mind updating JmsAutoConfigurationTests#testJmsListenerContainerFactoryWithCustomSettings
to validate the mapping of the receive timeout?
/** | ||
* Timeout to use for receive calls. | ||
*/ | ||
private Duration receiveTimeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current default is 1 second so it would be nice to have that documented and tested.
@@ -154,6 +154,11 @@ public void setSessionCacheSize(int sessionCacheSize) { | |||
*/ | |||
private Integer maxConcurrency; | |||
|
|||
/** | |||
* Timeout to use for receive calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0
and -1
have special meaning so it would be nice to have those documented here. See the javadoc of org.springframework.jms.listener.AbstractPollingMessageListenerContainer#setReceiveTimeout
@ibmmqmet could we please get some feedback on this? |
Sorry for the delay - other projects and being away from my desk got in the way... I've added the requested comments. But can't add the functions to the test file because the org.springframework.jms.listener.AbstractPollingMessageListenerContainer#getReceiveTimeout() method is marked "protected" (for no obvious reason) so can't be accessed directly. |
Thanks for the updates.
It is marked When we want to test the value of something that isn't publicly accessible we typically use reflection. AssertJ's Lines 168 to 169 in c44a6de
Could you please use this approach to test the new receive timeout property? In addition to the missing tests, unfortunately we also can't merge this due to the failing CLA check. Our current understanding is that your membership of the IBM or OpenLiberty GitHub organisations needs to be made public. |
Thanks for the updates. Any news on the CLA? Unfortunately, if this drags on too much longer we'll have to close the PR as the overhead of monitoring it is starting to outweigh the benefit of the changes. |
CLA seems to be signed now |
@ibmmqmet Thank you for signing the Contributor License Agreement! |
Thanks very much for making your first contribution to Spring Boot, @ibmmqmet. I'm pleased that we managed to get there in the end. |
The JMS receiveTimeout property
spring.jms.template.receive-timeout
is not being propagated from a configuration property into the created JMS Listener. That forces the application code to explicitly set it - which is something we find that applications rarely do and the default value is not good for performance in some environments.This small change copies the external config into the listener.
(I'm told there is now a corporate CLA in place to allow this to be accepted.)