Git Product home page Git Product logo

Comments (4)

artembilan avatar artembilan commented on April 29, 2024

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.

zhangheng0027 avatar zhangheng0027 commented on April 29, 2024

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.

garyrussell avatar garyrussell commented on April 29, 2024

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.

zhangheng0027 avatar zhangheng0027 commented on April 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.