Announcement Announcement Module
Collapse
No announcement yet.
Bug in SimpleMessageListenerContainer starting duplicate consumers? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug in SimpleMessageListenerContainer starting duplicate consumers?

    It appears there may be a bug SimpleMessageListenerContainer's doStart() method. What we saw was we would set 10 consumers for the container, but RabbitMQ was reporting that there were 20. After further debugging, it was clear that the doStart() method on the listener container was being called twice.

    We're using the RC2 of spring-amqp (still there in 1.0GA).

    Some quick background. We had originally been using an old 1.0.0 snapshot of spring-integration-amqp. Since it was not quite mature we had to write our own AmqpInboundEndpoint, which just copied the original, but with the added functionality of copying message headers. Additionally, we added a way to pass in the MessageListenerContainer (which we had had to subclass). Note: we intend to toss all this when spring-integration-amqp goes GA.

    In one particular instance, we had declared the message listener container as a top level bean and then referenced it in the inbound endpoint. Because the listener was a top level bean, it's doStart() method was being called. It was getting called a second time by the inbound endpoint's start() method.

    Now, I've noticed that in the spring-integration-amqp's trunk, you can pass in your message listener via the constructor, and it's autoStartup property is immediately set to false, so it probably alleviates this problem, but I would think the message listener should still guard against having it's doStart() method called twice.

    What was happening was effectively each channel was shared by two threads, with I believe is a no no and we were getting duplicate acks.

    Thoughts?

    Justin

  • #2
    Justin,

    First, thanks for providing such a detailed explanation!

    Second, can you open an issue in the Spring AMQP JIRA for this? We should be checking the isRunning status within doStart() like we do in doShutdown().

    Third, I'd recommend giving spring-integration-amqp-2.1.M1 a try. It might be handling everything that you have customized within your own implementation now, and if not, we would love to get that feedback so we can address it in M2.

    Thanks!
    -Mark

    Comment


    • #3
      Sure thing. Happy to help out when I can.

      I'll open the ticket first thing in the morning.

      I've looked at the 2.1 M1 release and I'll try it out as soon as I can. It looks like it adds lots of good improvements.

      Justin

      Comment

      Working...
      X