Announcement Announcement Module
Collapse
No announcement yet.
AMQP Connection not closed after using RabbitTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AMQP Connection not closed after using RabbitTemplate

    Hi,

    I am trying to publish a message from my application and once the message is published I need to dispose the underlying RabbitMQ connection used by the template. I do see this logic already in the finally block of the execute method in RabbitTemplate. They do get invoked after publishing the message, but my the JVM fails to exit and I see a thread holding AMQP Connection @ localhost:5672 potentially causing JVM to not exit.

    Is there a way to explicitly close the connection from the client side? I do not see any APIs in RabbitTemplate.

    Appreciate any pointers on how this can be handled.

    -Arul

  • #2
    I think I figured it out. Calling SingleConnectionFactory.destroy() fixes this problem.

    -Arul

    Comment


    • #3
      Can you provide some more details about the application? Are you building some task management infrastructure of your own that delegates to RabbitTemplate instances, or is this happening with an "out of the box" configuration?

      Thanks,
      Mark

      Comment


      • #4
        i use CachingConnectionFactory & also encounter this problem.
        and interface ConnectionFactory not provide a destroy() or close() method invoke,but its subclass AbstractConnectionFactory have ,so i must cast & invoke destroy().

        Comment

        Working...
        X