1
votes

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.

1
It's still not working after you added the from(errorChannel)? Turn on DEBUG logging and watch the message flow. - Gary Russell
I marked your question as "Unclear what you're asking" because we really don't know what is that your myDatabaseLogger. And what does it mean for your " doesn't do anything"? What do you expect from it to be done? That is fully your own component and your question is really has to start from it. Otherwise we are not able to help you. Thanks for understanding. - Artem Bilan

1 Answers

0
votes

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