I'm trying to configure spring-integration to send a message to a queue and then receive it, i.e. something very simple:
myApp -> outbound message -> jmsQueue -> inbound message -> myApp
What I thought was necessary for decoupling was to have a message gateway at either end of the process. Thus my first attempt (which works) looks like the following:
@MessagingGateway(name = "outboundGateway")
public interface OutboundGateway {
@Gateway(requestChannel = OUTBOUND_CHANNEL)
void sentMyObject(final MyObject myObject);
}
@Bean
public IntegrationFlow outboundFlow() {
return IntegrationFlows
.from(outboundChannel())
.handle(Jms.outboundAdapter(connectionFactory).destination(myQueue))
.get();
}
@Bean
public IntegrationFlow inboundFlow() {
return IntegrationFlows.from(Jms.messageDriverChannelAdapter(connectionFactory).destination(myQueue))
.channel(inboundChannel())
.handle(messageReceiverHandler())
.get();
}
Where messageReceiverHandler() is a bean that extends AbstractMessageHandler.
So above we have a message gateway for the outbound message. What I had presumed is that we should have one for the inbound message too, allowing us to decouple the incoming message handling from the application code. Instead we simply have a bean that extends AbstractMessageHandler, whereas I'd expect some gateway config. What's the correct usage?
Many thanks in adance.