Skip to content
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

JmsListener should allow delivery mode on response [SPR-15408] #19971

Closed
spring-issuemaster opened this issue Apr 3, 2017 · 4 comments
Closed

JmsListener should allow delivery mode on response [SPR-15408] #19971

spring-issuemaster opened this issue Apr 3, 2017 · 4 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Apr 3, 2017

James Kirrage opened SPR-15408 and commented

When setting up a JmsListener that can send a response, it appears that it is not possible to set the delivery mode of the response that is sent back. Instead, DeliveryMode.PERSISTENT (the default) is enforced.

It looks like the this is happening because AbstractAdaptableMessageListener.sendResponse does not have any provision for using the following API of javax.jmx.MessageProducer:

public void send(Message message, int deliveryMode, int priority, long timeToLive)

The logic in JmsTemplate.doSend calls producer.send in the following way:

if (isExplicitQosEnabled()) {
	producer.send(message, getDeliveryMode(), getPriority(), getTimeToLive());
}
else {
	producer.send(message);
}

Perhaps similar options could be set somewhere in the hierarchy of the containerFactory passed to a JmsListener?


Affects: 4.3.7

Referenced from: commits 1c0b3be, 4ffdb50

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 4, 2017

Stéphane Nicoll commented

It is an interesting problem but there are quite a lof of settings that are involved in sending a message. JmsTemplate itself (as you've mentioned) has a bunch of parameters and this is one of many.

We've taken the approach of going to a non declarative approach when things are getting more complicated. Perhaps we could have an optional "replyJmsTemplate" that you'd have to configure?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 4, 2017

James Kirrage commented

Thanks for your response - that may well be the best option. It would save quite a bit of duplication and would provide much more flexibility. As there's already a well established mechanism for sending messages (JmsTemplate), then it probably makes sense to use it rather than replicating it!

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 14, 2017

Stéphane Nicoll commented

OK we've decided to replicate the 3 properties of JmsTemplate (delivery mode, priority and time to live) and use that if any of those have been customized on the factory.

In the meantime in 4.x, you can override sendResponse in your own implementation and specify the flags that you want.

I'll probably reuse that information in Spring Boot, checking for an auto-configured JmsTemplate and passing the customizations along if QoS has been enabled.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 18, 2017

Stéphane Nicoll commented

It is now possible to set a QosSettings on the factory managing a @JmsListener and that's going to be used for replies. That object defines the persistent mode, the priority and the time to live settings.

That convenient object can also be set on a plain JmsTemplate now for better reusability.

The doc has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.