Add JmsTemplate overloads to JMS DSL channel specs#10933
Add JmsTemplate overloads to JMS DSL channel specs#10933cppwfs wants to merge 1 commit intospring-projects:mainfrom
Conversation
Fixes: spring-projects#2679 - Allow `JmsChannelFactoryBean` to accept an externally provided `JmsTemplate` - Add `Jms.pollableChannel(JmsTemplate)` and `Jms.pollableChannel(String, JmsTemplate)` factory methods - Add `Jms.channel(JmsTemplate)` factory method - Add protected constructors to `JmsPollableMessageChannelSpec` and `JmsMessageChannelSpec` accepting `JmsTemplate` - Add integration test verifying the polling flow with a `JmsTemplate`
artembilan
left a comment
There was a problem hiding this comment.
Some mentioning of this new option in the whats-new.adoc would be great.
Thanks
| this.jmsTemplate.setSessionAcknowledgeMode(sessionAcknowledgeMode); | ||
| } | ||
|
|
||
| public void setJmsTemplate(JmsTemplate jmsTemplate) { |
There was a problem hiding this comment.
@since and some other Javadocs.
And now, having this externally injected we need to protect against mutation.
Pay attention to all those setters delegating to the this.jmsTemplate.
We need to reject with something like assertLocalClient() in the HttpRequestExecutingMessageHandler.
The change is not one-to-one since here we don't have ctor injection, so might be the case that validation should go to the createInstance() (or initializeJmsTemplate()) when we would not worry about an order all those setters are called.
| } | ||
|
|
||
| /** | ||
| * The template to produce a {@link JmsPollableMessageChannelSpec}. |
There was a problem hiding this comment.
Maybe factory?
I'm not that "template" is producing anything.
It might be used from something what is producing, like factory 😄
Anyway, this is more about a proper wording in the Javadoc like we have in other methods of this class.
| this.jmsChannelFactoryBean = jmsChannelFactoryBean; | ||
| this.jmsChannelFactoryBean.setJmsTemplate(jmsTemplate); | ||
| this.jmsChannelFactoryBean.setSingleton(false); | ||
| this.jmsChannelFactoryBean.setBeanFactory(new DefaultListableBeanFactory()); |
There was a problem hiding this comment.
Let's consider to move two last lines into the doGet() before getObject().
This way we might not have duplication in these two ctors.
Fixes: #2679
JmsChannelFactoryBeanto accept an externally providedJmsTemplateJms.pollableChannel(JmsTemplate)andJms.pollableChannel(String, JmsTemplate)factory methodsJms.channel(JmsTemplate)factory methodJmsPollableMessageChannelSpecandJmsMessageChannelSpecacceptingJmsTemplateJmsTemplate