Is there a component for logging messages with Spring Integration using Java DSL?

Viewed 5126

I'm using Spring Integration to develop my integration scenarios. When I have to write some logs to provide some information, I write this way:

@Bean
IntegrationFlow blacklist(BlacklistService service) {
    return m -> m
            .wireTap(f -> f.handle(t -> log.info("Adding email source address in blacklist...")))
            .<MessageHandlingException, Blacklist>transform(p -> SourceBlacklist.of((Email) p.getFailedMessage().getHeaders().get(IntegrationConstants.MailSender.EMAIL)))
            .wireTap(f -> f.handle(t -> log.info("Email source address added to blacklist.")))
            .handle(service, "voidSave");
}

I'm using a wiretap with lambda and handle to log my messages. Is there a better way to write log with Spring Integration using Java DSL?

Thanks.

1 Answers
Related