1
votes

When deploying my microservice on spring cloud dataflow I get the following log:

No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created

how do I direct error flows?

My guess is to create an errorChannel bean (as the message says). But I did not find any docs about it nor sample usages.

For example, I have a sink that executes an Insert on a database and want to direct it elsewhere if insert fails.

1

1 Answers

1
votes

The default errorChannel bean has a LoggingHandler subscribed to it.

If you define your own errorHandler channel, it won't get the default LoggingHandler.

The error channel is automatically wired in.

Each consumer (or @StreamListener) gets a dedicated error channel binding.group.errors which is bridged to the global errorChannel.

You can add a @ServiceActivator to consume ErrorMessages from either of these channels.

Error channels are not applied on the producer side; you have to catch the exception yourself.