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!
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