Hello All,
I'm looking at a very simple example sending a message using AmqpTemplate#convertAndSend. I don't understand why the program won't terminate w/o an explicit System.exit(0).
Is it because it's waiting on an ACK?
Can someone please explain?
Thanks!
--john
@Grapes([
@Grab(group='org.springframework.amqp', module='spring-rabbit', version='1.1.3.RELEASE')
])
public class SendAmqp {
public static void main(String[] argv) throws Exception {
ConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.host = "localhost"
AmqpAdmin admin = new RabbitAdmin(connectionFactory);
admin.declareQueue(new Queue("myqueue"));
AmqpTemplate template = new RabbitTemplate(connectionFactory);
template.convertAndSend("myqueue", "foo")
//without this, program won't exit
System.exit(0)
}
}


Reply With Quote