tickTime=2000 initLimit=10 syncLimit=5 dataDir=/tmp/zookeeper clientPort=2181 server.1=192.168.3.10:2888:3888 server.2=192.168.3.11:2888:3888 server.3=192.168.3.11:2888:3888
wzh@hd-master:~/zk/zookeeper-3.5.2-alpha/bin$ ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /home/wzh/zk/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
wzh@hd-slave1:~/zk/zookeeper-3.5.2-alpha/bin$ ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /home/wzh/zk/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
wzh@hd-slave2:~/zk/zookeeper-3.5.2-alpha/bin$ ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /home/wzh/zk/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
<persistenceAdapter>
<!--
<kahaDB directory="${activemq.data}/kahadb"/>
-->
<replicatedLevelDB
directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:0"
zkAddress="192.168.3.10:2181,192.168.3.11:2181"
hostname="192.168.3.10"
sync="local_disk"
zkPath="/activemq/leveldb-stores"/>
</persistenceAdapter>
wzh@hd-master:~/amq$ ./apache-activemq-5.13.0/bin/activemq status INFO: Loading '/home/wzh/amq/apache-activemq-5.13.0//bin/env' INFO: Using java '/opt/java/jdk1.8.0_91/bin/java' ActiveMQ is running (pid '2031') wzh@hd-master:~/amq$
dependencies {
compile('org.springframework.boot:spring-boot-starter-activemq')
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
spring.activemq.broker-url=failover:(tcp://192.168.3.10:61616,tcp://192.168.3.11:61616,tcp://192.168.3.12:61616) spring.activemq.in-memory=true spring.activemq.pool.enabled=false spring.activemq.user=admin spring.activemq.password=admin
@Service
public class Producer {
@Autowired
private JmsMessagingTemplate jmsTemplate;
public void sendMessage(Destination destination, final String message){
jmsTemplate.convertAndSend(destination, message);
}
}
@Component
public class Consumer {
@JmsListener(destination = "test.queue")
public void receiveQueue(String text){
System.out.println("Consumer收到的报文为:"+text);
}
}
@RestController
@RequestMapping(
value = "/test",
headers = "Accept=application/json",
produces = "application/json;charset=utf-8"
)
public class TestCtrl {
@Autowired
Producer producer;
Destination destination = new ActiveMQQueue("test.queue");
@RequestMapping(
value = "/say/{msg}/to/{name}",
method = RequestMethod.GET
)
public Map<String, Object> say(@PathVariable String msg, @PathVariable String name){
Map<String, Object> map = new HashMap<>();
map.put("msg", msg);
map.put("name", name);
producer.sendMessage(destination, msg);
return map;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有