I've been moving my dev-environment from Linux to Mac and suddenly I'm facing weird RabbitMQ behavior.
I had Ubuntu box, on which RabbitMQ 2.8.7-1 runned and I did dev stuff on the same box. I've been running my testcode (provided below) and Rabbit were happy to receive all messages.
// using spring-rabbit 1.1.1.RELEASE
AmqpTemplate amqpTemplate = (AmqpTemplate) context.getBean("amqpTemplate");
amqpTemplate.convertAndSend("bar.queue", "Foo message");
Now I moved to Mac box (host A), in which I'm running VirtualBox with Linux (host B), on which runs RabbitMQ with the same configuration as on previous Linux box. I'm running my dev environment on Mac, which calls Rabbit inside VM :). But nothing came, so I used Wireshark to track down communication, which seems ok:
. . . .
B > A: Connection.Start
A > B: Connection.Start-Ok
B > A: Connection.Tune
A > B: Connection.Tune-Ok
A > B: Connection.Open
B > A: Connection.Open-Ok
A > B: Channel.Open
B > A: Channel.Open-Ok
A > B: Basic.Publish (bar.queue)
A > B: Content-Header (text/plain)
A > B: Content-Body (Foo message)
A > B: Channel.Close (200-OK)
B > A: [[TCP ACK for Channel.Close]]
. . . .
So it looks like message had been received, but maybe not processed by broker? Log on client side also tells me that message was published.
17:09:37.450 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'amqpTemplate'
17:09:37.576 [main] DEBUG o.s.a.r.c.CachingConnectionFactory - Creating cached Rabbit Channel from AMQChannel(amqp://guest@hostB:5672/,1)
17:09:37.611 [main] DEBUG o.s.amqp.rabbit.core.RabbitTemplate - Executing callback on RabbitMQ Channel: Cached Rabbit Channel: AMQChannel(amqp://guest@hostB:5672/,1)
17:09:37.612 [main] DEBUG o.s.amqp.rabbit.core.RabbitTemplate - Publishing message on exchange [], routingKey = [bar.queue]
I have absolutely no idea where to start looking after problem, why it was working before and not now, where can be problem?
edit: OK, I tried to implement simple sender from RabbitMQ tutorial and it looks like it hangs on close(), because application still runs and code after close() is not reached.
channel.basicPublish(exchangeName, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, messageBodyBytes);
channel.close();
// this is never reached and app still running :-o
conn.close();