Search code examples
spring-integrationspring-integration-dsl

Spring Integration Java DSL: In the error channel database logger is not working


I have my database logger myDatabaseLogger which doesn't do anything in the errorChannel channel. The System.out.println command is working in the errorChannel channel.

My database logger myDatabaseLogger works in other flows.

How to get the my database logger myDatabaseLogger working in the errorChannel channel?

Here is my code:

    @Autowired
@Qualifier("errorChannel")
private PublishSubscribeChannel errorChannel;

@Bean
public IntegrationFlow errorHandlingFlow() {
    return IntegrationFlows
            .from(errorChannel)
            .handle(myDatabaseLogger, "log")
            .handle(message -> System.out
                    .println("The error happened:" + ((MessagingException) message.getPayload()).getMessage()))
            .get();
}

Edit:

Sorry about delay, just came from holiday.

The myDatabaseLogger class is simple Java class which writes to the database with the repository, which extends org.springframework.data.repository.CrudRepository. In the method errorHandlingFlow no lines are written to the database.

I will later use the DEBUG logging and try to investigate this more.


Solution

  • The DEBUG logger could be used here to find cause of the problem.