1

I have been required to log the integration flow requests and save to logs that I am getting to the database. Logging the request is working fine, but my question is how can I store this logs that I am getting from the logAndReply() to the database?

 return IntegrationFlows.from(Http.inboundGateway("/foo")
                            .requestMapping(m -> m.methods(HttpMethod.POST))
                            .validator(new Validator()).errorChannel("errorHandler.input"))
                    .transform(Transformers.objectToString())
                  
                    .transform(new TransformingMethod())
                    .logAndReply(LoggingHandler.Level.INFO);
Bash
  • 101
  • 11

1 Answers1

1

This is the part of your logging framework and in most cases it is called JdbcAppender. For example Log4J:

https://howtodoinjava.com/log4j2/jdbcappender-example/ log4j2 JDBCAppender with Spring http://smasue.github.io/log4j2-spring-database-appender

On the other hand, instead of relying on the logging framework, you can do it yourself and use a JdbcMessageHandler: https://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-outbound-channel-adapter

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118