ActiveMQ学习笔记之四--启动嵌入式Broker(纯代码方式) 博客分类: java
程序员文章站
2024-02-22 09:11:53
...
启动嵌入式Broker(纯代码方式)
Broker最小依赖的JAR包集合:
手动启动Broker:
BrokerService broker = new BrokerService();
broker.addConnector("tcp://localhost:61616");
broker.setPersistent(false);
broker.setUseJmx(false); //启用JMX监控
//启用Advisory指定队列的消息监控
PolicyMap policy = new PolicyMap();
PolicyEntry entry = new PolicyEntry();
entry.setAdvisoryForConsumed(true);
policy.put(new ActiveMQQueue(">"), entry);
broker.setDestinationPolicy(policy);
broker.start();
while (true) {
Thread.sleep(100000);
}
附件:嵌入式Broker
上一篇: 证书制作 博客分类: java
下一篇: java实现简单租车系统