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.
Well
void stop()
does not return a result whereasboolean 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
or add
default-reply-timeout="0"
to the gateway and you will get anull
return.