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

Configure reply type via JmsListenerContainerFactory [SPR-12911] #17510

Closed
spring-issuemaster opened this issue Apr 15, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Apr 15, 2015

Stephan Oudmaijer opened SPR-12911 and commented

In our scenario we listen for messages on a queue but we want to be able to reply on a topic.

Using the @JmsListener(destination = "someQueue") with @Reply("someTopic") does not work with the DefaultMessageListenerContainerFactory out of the box. Example:

@JmsListener(destination = "someQueue")
@SendTo("someTopic")
public Message<SomeResponse> onMessage(final Some request) {
   ...
}

Because the DMLC uses the pubSubDomain property for the DynamicDestinationResolver for both the destination resolution and the MessageListenerAdapters DynamicDestinationResolver.


Affects: 4.1.4

Referenced from: commits 2c7d2d3

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2015

Stéphane Nicoll commented

@SendTo is a general annotations (it has nothing JMS-specific in it) and we just fallback on the support we had for years (i.e. replying on the same destination type as the one we listen to). I am actually if that use case is that frequent. In any case you can inject a JmsTemplate and do whatever you want.

But we could do better, something like @SendTo("topic:/myTopic") to mention that the response should be sent to a topic with name "myTopic". I am not sure about the prefix structure as some JMS brokers are actually using topic as a prefix as well.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2015

Stéphane Nicoll commented

As for the DestinationResolver, please create a separate issue. This is unrelated, really. Thanks!

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2015

Stephan Oudmaijer commented

Hi Stéphane, Thanks for your great work on the JMS improvements in Spring! Although I do like the idea of the topic:/ prefix, it does introduce a hard dependency on the (reply) destination type. In my current project we have a Listener that in production replies to a topic, but in our integration tests we reply directly to a queue. So the topic:/ prefix in the component introduces a challenge.

I would suggest to make it configurable via the DefaultMessageListenerContainerFactory in a simular way Spring Integration has it: reply-pub-sub-domain=""(16) (http://docs.spring.io/spring-integration/reference/html/jms.html)

What do you think?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2015

Stéphane Nicoll commented

I like that idea. Thanks!

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2015

Stéphane Nicoll commented

This is now available as part of 2c7d2d38

A new "replyPubSubDomain" attribute is available on the factory. The XML namespace has been improved as well to expose a "response-destination-type" attribute at the container level.

This should be available in a 4.2.0.BUILD-SNAPSHOT in a moment. Please try it out. Thanks!

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