Comments (4)
Sorry, this info is not enough.
Any chances to have a simple sample from you, so we can reproduce on our side and determine what is wrong (if any)?
from spring-amqp.
Sorry, this info is not enough. Any chances to have a simple sample from you, so we can reproduce on our side and determine what is wrong (if any)?
https://github.com/zhangheng0027/testRabbitMQ.git
rabbitmq version 3.9.29
After starting the application,
run com.example.testrabbitmq.TestRabbitMqApplicationTests#test02
Test02 is expected to output 4 messages
from spring-amqp.
The batching is done by the container; from the container's perspective the listener adapter (and converter) are part of the listener. It would not know how to deal with such problems so the whole batch is rejected.
This is not really something the framework can deal with because it doesn't know what to do with the exception.
I suggest you do something like this:
class MyConverter extends Jackson2JsonMessageConverter {
public MyConverter(ObjectMapper objectMapper) {
super(objectMapper);
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
try {
return super.fromMessage(message);
}
catch (MessageConversionException ex) {
TestListen.EquipmentStatusChangeEvent event = new TestListen.EquipmentStatusChangeEvent();
event.setData("invalid:" + ex.getMessage());
return event;
}
}
}
2023-09-25T14:25:23.714-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 0 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:23.715-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 1 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:23.818-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 2 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:23.818-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 3 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:24.929-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 4 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:33.688-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 5 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:33.688-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 6 ==== test TestListen.EquipmentStatusChangeEvent(data=invalid:Failed to convert Message content, age=null) ====================
2023-09-25T14:25:33.793-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 7 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:33.794-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 8 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
2023-09-25T14:25:34.901-04:00 INFO 16563 --- [ntContainer#0-1] c.e.testrabbitmq.listen.TestListen : 9 ==== test TestListen.EquipmentStatusChangeEvent(data=null, age=null) ====================
from spring-amqp.
In the next few days, I will review the source code to determine if the container can reject a single message in bulk. I think it's possible when it should be.
from spring-amqp.
Related Issues (20)
- Get rid of `synchronized (this.consumersMonitor)` in the `SimpleMessageListenerContainer`
- CachingConnectionFactory leaks channels during connection resets when used in a SimpleMessageContainer HOT 1
- RabbitTemplate with SIMPLE correlation causes uncached channels
- Get rid of `synchronized` blocks in the `CachingConnectionFactory`
- Get rid of `synchronized` in `RabbitAdmin`
- Get rid of `synchronized` in `RabbitTemplate` HOT 1
- Get rid of `synchronized` in the `BlockingQueueConsumer`
- Get rid of `synchronized` in `spring-rabbit-test` module
- Get rid of the rest of `synchronized` in the ListenerContainer infrastructure
- Improve Extensibility of RepublishMessageRecovererWithConfirms by supporting SpEL expressions HOT 1
- AmqpRejectAndDontRequeueException completely restarts Consumer HOT 2
- The `SimpleMessageListenerContainer` does not shutdown properly
- The `SimpleMessageListenerContainer` does not shutdown properly HOT 1
- Swallowed exception 'AmqpTimeoutException: No available channels' HOT 4
- Add batchReceiveTimeout in SimpleMessageListenerContainer HOT 3
- MessageProperties setDelay maximum value problem HOT 3
- ImmediateAcknowledgeAmqpException keeps the message in the queue HOT 10
- TraceId propagation to the new thread local HOT 4
- Wrong ClassLoader is used for message deserialization when devtools are active
- Wrong ClassLoader is used for message deserialization when devtools are active HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-amqp.