Announcement Announcement Module
Collapse
No announcement yet.
Reconnect with SimpleMessageListenerContainer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reconnect with SimpleMessageListenerContainer

    We're noticing that if we shutdown rabbitmq and restart it, without restarting our app, our listeners will not reconnect automatically when using the CachingConnectionFactory.

    It's difficult to say exactly which class should be responsible here, but what appears to be happening is when the BlockingQueueConsumer receives an error in the InternalConsumer, all it's really doing is throwing that exception up the chain, to the point where it's caught in the SimpleMessageListenerContainer. The container catches it and attempts to restart the consumer. At this point though, the Connection and Channel have already been closed and are now unusable. The container then asks the CachingConnectionFactory for a new connection, but since the CCF had no idea there was a failure, it hands back the same connection and channel -- which are in a closed state and can't be used.

    I think we can work around this for the time being by overriding createBlockingQueueConsumer() and checking that the Connection is open, and if not AND we're using a CCF, then destroy the CCF (which has the effect of recreating the connection and channel).

    This isn't an ideal solution since it forces you to use a custom message listener container and that may not be possible for some. Also, it's really only an issue when using the CCF, so it would be great if the solution were somehow baked into the CCF so that everyone can take advantage of it.

    Am I missing some key piece of a SMLC that should allow it to reconnect in this event?

    Thanks,
    Justin

  • #2
    What version of Spring AMQP are you using? We did a lot of work on small issues relating to reconnecting to a dead broker between RC1 and the final release, so if you aren't using 1.0.0 then please just upgrade and try again.

    Comment


    • #3
      We're using RC2. We plan on upgrading to the GA asap though. Was any work done on this issue between RC2 and the GA?

      Comment


      • #4
        For sure. Even between RC3 and the GA I think the cold re-connect behaviour changed.

        Comment

        Working...
        X