Spring Integration Gateway Service method not returning upon start/stop

338 views Asked by At

I created a control channel and a gateway service to send a control message to that channel. However after I call the gateway service method that is supposed to return boolean is not returning after message submission.

Code Snippet:

public interface SampleControlService {
     boolean sendControl(String message);
}

....

@Autowired
private SampleControlService sampleControlService;

.....

boolean done = sampleControlService.sendControl("@testAdapter.stop()"); // message gets sent but it is not returning to caller

System.out.println("Done : " + done); // this line doesn't execute


// integration config
<int:channel id="controlChannel"/>
<int:gateway service-interface="com.test.service.SampleControlService" default-request-channel="controlChannel" />
<int:control-bus input-channel="controlChannel"/>

However, if I send a message @testAdapter.isRunning() to check the status, it returns as expected.

1

There are 1 answers

0
Gary Russell On BEST ANSWER

Well void stop() does not return a result whereas boolean isRunning() does; the gateway does not know anything about the method being called; you are "telling" the framework you are expecting a result that will never come.

You can add another gateway method

void sendOneWayControl(String command);

or add default-reply-timeout="0" to the gateway and you will get a null return.