Skip to content

error-handler-definition not subscribed to producer error channel #2997

Closed
@Nephery

Description

@Nephery

Describe the issue
When the producer error channel is enabled and an error-handler-definition is defined for that binding, the error handler doesn't receive any error messages.

To Reproduce
Steps to reproduce the behavior:

  1. Create a error handler function like:
    @Bean
    public Consumer<ErrorMessage> myErrorHandlerFnc() {
        msg -> logger.info("failed to publish message {}", msg);
    }
  2. Configure any output binding as follows:
    spring.cloud.stream.bindings.<binding-name>.producer.error-channel-enabled=true
    spring.cloud.stream.bindings.<binding-name>.error-handler-definition=myErrorHandlerFnc
  3. Cause the producer binding to throw an exception
  4. Notice that myErrorHandlerFnc doesn't receive the error message.

Version of the framework
Spring Boot: 3.3.2
Spring Cloud: 2023.0.3

Expected behavior
myErrorHandlerFnc to receive error messages from the producer binding.

Additional context
Looking at AbstractMessageChannelBinder.registerErrorInfrastructure(
ProducerDestination destination, String bindingName)
, it seems like subscribeFunctionErrorHandler() needs to be called there against the producer binding's error channel.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions