Could not start 2 embedded active-mq on different ports within different spring boot applications

廉价感情. 提交于 2019-11-27 15:54:44

your config broker.addConnector("tcp://localhost:61616?broker.persistent=false"); is wrong, this is can be done only if you create a broker using ActiveMQConnectionFactory, http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html#HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory

Using ActiveMQConnectionFactory
An embedded broker can also be created using an ActiveMQConnectionFactory and using a vm connector as a uri. e.g.
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");

try

 @Bean
  public BrokerService broker() throws Exception {
    BrokerService broker = new BrokerService();
    broker.addConnector("tcp://localhost:61616");
    broker.setPersistent(false);
    return broker;
  }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!