1 配置类ActiveMQConfig
@Configuration @Value(“${spring.activemq.broker-url:disabled}”) @Value(“${activemq.listener.enable:disabled}”) @Bean //定义一个消息监听器连接工厂,这里定义的是点对点模式的监听器连接工厂 factory.setConnectionFactory(activeMQConnectionFactory); //重连间隔时间 return factory; @Bean } |
2 工具类ActiveMQUtil
public class ActiveMQUtil { public ConnectionFactory init(String brokerUrl) { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl); public ConnectionFactory getConnectionFactory(){
|