Results 1 to 4 of 4

Thread: AMQP Connection not closed after using RabbitTemplate

  1. #1
    Join Date
    Aug 2008
    Location
    Billings, Montana
    Posts
    47

    Default 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. #2
    Join Date
    Aug 2008
    Location
    Billings, Montana
    Posts
    47

    Default

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

    -Arul

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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

  4. #4
    Join Date
    Nov 2012
    Posts
    18

    Default

    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().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •