其他分享
首页 > 其他分享> > ActiveMQ 的 Broker

ActiveMQ 的 Broker

作者:互联网

相当于一个ActiveMQ的实例。
Broker实现了用代码的形式启动ActiveMQ将MQ嵌入到Java代码中,以便随时用随时启动,在用的时候再去启动这样能节省资源,也保证了可靠性

		<dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-all</artifactId>
            <version>5.15.10</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.9</version>
        </dependency>
public class EmbedBroker {

    public static void main(String[] args) throws Exception {
        BrokerService brokerService = new BrokerService();
        brokerService.setUseJmx(true);
        brokerService.addConnector("tcp://localhost:61616");
        brokerService.start();
    }
}

标签:jackson,Broker,BrokerService,brokerService,ActiveMQ,public
来源: https://blog.csdn.net/sakuragio/article/details/100990330