spring配置文件:




























生产者:


































消费者:





























测试步骤:
1、启动ActiveMQ (bin下的activemq.bat)
2、运行HelloWorldReciver
出现以下提示:will wait:-1 seconds for message
3、运行HelloWorldSender
出现以下结果:
will wait:-1 seconds for message
reviced msg is:11
几点说明:JmsTemplate的默认reserviceTimeout为-1,也就是用不超时,等待接受消息,单位为毫秒