I am writing the sample code for basic-amqp example (https://github.com/spring-projects/spring-integration-samples/blob/master/basic/amqp/src/main/resources/META-INF/spring/integration/spring-integration-context.xml) in DSL
@Bean
public IntegrationFlow receiveGreetingFromGreetingQueueToConsole(ConnectionFactory connectionFactory) {
return IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, "greeting.queue"))
.log()
.<String,String>transform(m -> "Received " + m)
.handle(CharacterStreamWritingMessageHandler.stdout())
.get();
}
How do I apply the setShouldAppendNewLine boolean on the
.handle(CharacterStreamWritingMessageHandler.stdout())
I don't want to declare the handler as a bean only to set this property. Wish stdout accepted a parameter for this.
It doesn't have to be a bean...
@Bean
public IntegrationFlow receiveGreetingFromGreetingQueueToConsole(ConnectionFactory connectionFactory) {
CharacterStreamWritingMessageHandler stdout = CharacterStreamWritingMessageHandler.stdout();
stdout.setShouldAppendNewLine(true);
return IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, "greeting.queue"))
.log()
.<String,String>transform(m -> "Received " + m)
.handle(stdout)
.get();
}
However, I agree that a fluent API would be nice for the DSL to use; please open an issue on GitHub.