java - Spring Integration DSL JMS Inbound/Outbound Gateways -


i'm trying configure spring-integration send message queue , receive it, i.e. simple:

myapp -> outbound message -> jmsqueue -> inbound message -> myapp 

what thought necessary decoupling have message gateway @ either end of process. first attempt (which works) looks 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() bean extends abstractmessagehandler.

so above have message gateway outbound message. had presumed should have 1 inbound message too, allowing decouple incoming message handling application code. instead have bean extends abstractmessagehandler, whereas i'd expect gateway config. what's correct usage?

many in adance.

first of all, need use jms.outboundgateway() request/reply messsaging rather 2 separate flows; can make work adapters needs more work and, in scenario, doesn't provide benefit.

you can use:

... .from(outboundchannel()) .handle(jms.outboundgateway(...)) .handle("mypojo", "somemethod") .get(); 

where mypojo bean containing application code method taking type returned gateway. reply gateway goes next element in flow.

it not recommended inherit framework classes, unless have special requirements.

edit

however, expects remote system reply using jmsreplyto header. also, reply second handler go gateway (which shouldn't have void reply).

for async request/reply configuration correct, can use pojo in .handle().


Comments