I have a service activator configured in a simple POJO and I want to convert it into Java DSL.
Right now, my Java DSL looks like this,
public IntegrationFlow inputFlow() {
return IntegrationFlows.from(inputChannel())
.log(LoggingHandler.Level.DEBUG, "com.dash.messages")
.transform(Transformers.fromJson(MessageWrapper.class, customObjectMapper()))
.channel(theOtherChannel()))
.get();
}
There is a POJO with a service activator in it,
public class MessageProcessor {
private static final Logger logger = LoggerFactory.getLogger(MessageProcessor.class);
....
@ServiceActivator
public void handle(MessageWrapper message, @Headers Map<String, Object> headers) {
logger.debug("Message received: " + message);
// Send message to another system
....
}
}
In XML, the corresponding configuration is as shown below,
<int:service-activator input-channel="theOtherChannel"
ref="MessageProcessor" output-channel="nullChannel" />
- How do I invoke the ServiceActivator method in Java DSL? I am thinking of using
.handle(), but what should be the argument(s)? - Is there any concept of a
nullchannel when using Java DSL? If yes, how do we specify it?