I'm new in Spring Integration, I'm trying to get the message from temporary channel.
Reading the documentation there is a temporary channel use by spring.
I guess it named NullChannel
I need my gateway
returns the value from temporary channel.
http controller -> gateway -> direct channel -> activator 1 -> queue channel -> activator 2
So my activator 2
will put the new value into temporary channel, so the gateway
will retrieve the value from temporary channel
@MessageEndpoint
public class Activator2 {
@Autowired
private NullChannel nullChannel;
@ServiceActivator(inputChannel = "asyncChannel")
public void plus(Integer message){
try {
message++;
Thread.sleep(2000);
nullChannel.send(MessageBuilder.withPayload(message).build());
log.info("Activator 2: " +message );
} catch (InterruptedException e) {
log.error("I don't want to sleep");
}
}
}
it not working. I'm not sure if everything is well connected
NullChannel
is like /dev/null
in Unix; it just discards the value.
@ServiceActivator(inputChannel = "asyncChannel")
public Integer plus(Integer message){
return message;
}
will automatically do what you want.
If there is no outputChannel
, the framework sends the result to the replyChannel
header.