-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error-handler-definition not subscribed to producer error channel #2997
Comments
I just tested it with the following (complete app)
And I see successful invocation of error handler
|
Also, you don't need |
@Nephery I just tested it with the output binding and it's working as well, so you may want to provide me with a small sample top reproduce or we can have a screen share session and see what's going on. Let me know |
Managed to reproduce it with a modified version of this rabbit MQ sample:
Now to confirm that messages are being sent to the
|
It also doesn't work for kafka. Also, when this setting is enabled, an entry appears in the logs: Version of the framework |
Backporting it to 4.1 as well |
@olegz This works with StreamBridge, but does not work through integration. See example https://github.com/dima-bzz/testkafka/tree/error-handler |
When you say |
Also, your code does not even use the latest snapshot
So how is is related to the change of this issue?
|
@olegz I have fixed the Spring Cloud version. I probably put it wrong. I mean, when using Spring Cloud Function Supplier, error-handler-definition does not work. If I send a message via StreamBridge and an error occurs in sending, then error-handler-definition works. Not working error-handler-definition @Bean
public Supplier<String> source1() {
return () -> {
String message = "FromSource1";
System.out.println("******************");
System.out.println("From Source1");
System.out.println("******************");
System.out.println("Sending value: " + message);
throw new RuntimeException("123"); // this send Error message to 'errorChannel'
};
} Working error-handler-definition @Scheduled(fixedDelay = 3000)
public void send() {
this.streamBridge.send("source1-out-0",
MessageBuilder.withPayload("123").setHeader(KafkaHeaders.KEY, 1L).build()); // this send Error message to 'kafka-102312345.source1-out-0.errors'
} |
I kind of got it. In the first case, the error occurs before calling the sending handler in Kafka, |
The error thrown inside of a function constitutes consumer error, (e.g., |
Thanks, I understand now. |
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:
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.The text was updated successfully, but these errors were encountered: