• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Spring AMQP - JVM not closing after message is sent?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm relatively new to Spring and very new to RabbitMQ. I've been trying to learn the basics of Spring's AMQP integration, but I'm getting hung up on something.

All I'm trying to do is create a basic RabbitTemplate and send a simple String to the default exchange, with the routing key set to just a test queue I made. That all works fine - the message is sent, and the SimpleMessageListenerContainer consumes and processes the message just fine.

Everything (I believe) is being created within the Spring context, and it's all just started from a main method - what seems to be happening though is whatever thread that sends the message is not ending, and as a result the JVM will not close until I actually stop it (all from within Eclipse)

Here is my app configuration:



And here is my MessageHandler:



And finally the main App that launches the context:



Is this expected? Am I just missing some fundamental concept? Any help in understanding this behavior would be greatly appreciated!
 
Mahalaghda Gumbahldi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh and one other piece I forgot to mention - Until I close the JVM myself, 1 connection and 1 channel do remain open in the RabbitMQ admin page. So I'm guessing that has something to do with it - but I cannot figure out how to get that connection to close? I would think that the context closing would signal the connection to close as well, but as I said I am very new to all of this
 
Mahalaghda Gumbahldi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just figured out the issue - my app class wasn't being loaded into/from the context >_<
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic