1.在父配置文件中增加
<!-- topic 发布订阅 -->
<bean id="topicDestination" class="org.apache.activemq.command.ActiveMQTopic">
<constructor-arg value="topic"></constructor-arg>
</bean>
2.修改生产者服务实现类
@Autowired
@Qualifier(value="topicDestination")
private Destination destination;
2.修改消费者配置文件中容器中目的地的引用
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"></property>
<property name="destination" ref="topicDestination"></property>
<property name="messageListener" ref="consumerMessageListener"></property>
</bean>
其他的不变,同上一篇队列模式中一致