You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
Using the rabbitmq-Binder, with a consumer configured for consumer side batching as drescribed here, when a message is received, which is not convertible to the target type, the message is silently dropped.
To Reproduce
Set up a local rabbitmq
Set up a simple Spring-Boot App using the rabbit-binder
spring.cloud.stream.rabbit.default.consumer.auto-bind-dlq=true # not necessary for reproductionspring.cloud.stream.bindings.listener-in-0.destination=some-destination
spring.cloud.stream.bindings.listener-in-0.group=l
spring.cloud.stream.bindings.listener-in-0.consumer.batch-mode=true
spring.cloud.stream.rabbit.bindings.listener-in-0.consumer.batch-size=10
spring.cloud.stream.rabbit.bindings.listener-in-0.consumer.enable-batching=true
spring.cloud.stream.rabbit.bindings.listener-in-0.consumer.receive-timeout=100
# Useful to see what is actually happening (makes this less silent)logging.level.org.springframework.cloud.function.context.config.JsonMessageConverter=debug
Set up a consumer consuming some Dto, which is sent as JSON:
@SpringBootApplicationpublicclassDemo1Application {
publicstaticvoidmain(String[] args) {
SpringApplication.run(Demo1Application.class, args);
}
public record MyDto(inti) {}
@BeanpublicConsumer<List<MyDto>> listener() {
returnSystem.out::println;
}
}
Send a message which cannot be converted to MyDto
@BeanpublicApplicationRunnerapplicationRunner(AmqpTemplateamqpTemplate) {
returnargs -> {
// send two test messages to the consumer, first one deserializes fine, second does notamqpTemplate.send("some-destination", "", MessageBuilder.withBody("{\"i\": 42}".getBytes(StandardCharsets.UTF_8)).setContentType("application/json").build());
amqpTemplate.send("some-destination", "", MessageBuilder.withBody("{\"i\": \"A STRING\"}".getBytes(StandardCharsets.UTF_8)).setContentType("application/json").build());
};
}
Observe only one message is printed to console, the DLQ is empty.
[MyDto[i=42]]
Version of the framework
spring-boot 3.3.2 and spring cloud 2023.0.3 Expected behavior
I would expect both messages to be DLQed instead. This would match the behaviour without batching, where an inconvertible Message is DLQed.
Additional context
The Example is a bit artificial, a more realistic example would be an unexpected Enum-Value.
This might also apply to the kafka-binder, I haven't tested that.
The text was updated successfully, but these errors were encountered:
Describe the issue
Using the rabbitmq-Binder, with a consumer configured for consumer side batching as drescribed here, when a message is received, which is not convertible to the target type, the message is silently dropped.
To Reproduce
MyDto
Version of the framework
spring-boot 3.3.2 and spring cloud 2023.0.3
Expected behavior
I would expect both messages to be DLQed instead. This would match the behaviour without batching, where an inconvertible Message is DLQed.
Additional context
The Example is a bit artificial, a more realistic example would be an unexpected Enum-Value.
This might also apply to the kafka-binder, I haven't tested that.
The text was updated successfully, but these errors were encountered: