Reputation: 6858
I am trying to create an app that will listen to JMS queue, process message and sends response to another JMS queue. As I understood the docs I can use JMS inbound gateway and some handler to process the request, something like this:
IntegrationFlows.from(Jms.inboundGateway(connectionFactory).defaultReplyQueueName(responseQueue)).handle(handler).get();
However I don't know how to set the input JMS queue via DSL. I found that via XML it can be done as following:
<int-jms:inbound-gateway id="jmsInGateway"
request-destination="inQueue"
request-channel="exampleChannel"/>
Sadly Jms.inboundGateway()
does not allow to set request destination. How can I set it?
Upvotes: 0
Views: 133
Reputation: 121442
There are these two options for destination on that Spec
:
/**
* @param destination the destination
* @return the spec.
* @see JmsListenerContainerSpec#destination(Destination)
*/
public JmsInboundGatewayListenerContainerSpec<S, C> destination(Destination destination) {
this.spec.destination(destination);
return _this();
}
/**
* @param destinationName the destinationName
* @return the spec.
* @see JmsListenerContainerSpec#destination(String)
*/
public JmsInboundGatewayListenerContainerSpec<S, C> destination(String destinationName) {
this.spec.destination(destinationName);
return _this();
}
So, your code snippet works for me like this:
return IntegrationFlows.from(
Jms.inboundGateway(connectionFactory)
.destination("inQueue")
.defaultReplyQueueName(responseQueue))
.handle(handler)
.get();
I'm not sure why is that not visible for you...
On the other hand I see your point. It is probably better to name that option as a requestDestination
for consistency with the replyQueueName
and the same option in the XML DSL. Feel free to raise a GH issue or even provide a contribution on the matter deprecating an existing destination
option!
Upvotes: 1