怎么做中英文版网站,wordpress调用百度网盘视频,wordpress安卓版5,婚纱摄影影楼这是本人学习的总结#xff0c;主要学习资料如下
马士兵教育rocketMq官方文档 目录 1、Overview1.1、创建MQClientInstance1.1.1、检查1.1.1、MQClientInstance的ID 1.2、MQClientInstance.start() 1、Overview 这是发送信息的代码样例#xff0c;
DefaultMQProducer produ…这是本人学习的总结主要学习资料如下
马士兵教育rocketMq官方文档 目录 1、Overview1.1、创建MQClientInstance1.1.1、检查1.1.1、MQClientInstance的ID 1.2、MQClientInstance.start() 1、Overview 这是发送信息的代码样例
DefaultMQProducer producer new DefaultMQProducer(PRODUCER_GROUP);
producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);
producer.start();
for (int i 0; i MESSAGE_COUNT; i) {try {Message msg new Message(TOPIC, TAG, (Hello RocketMQ i).getBytes(RemotingHelper.DEFAULT_CHARSET));SendResult sendResult producer.send(msg);System.out.printf(%s%n, sendResult);} catch (Exception e) {e.printStackTrace();Thread.sleep(1000);}
}
producer.shutdown();生产者启动最少需要两个信息group和nameSrvAddr。启动的源码则是producer#start()中。
最终RocketMQ会创建MQClientInstance的实例然后在调用MQClientInstance#start()完成生产者的启动。
1.1、创建MQClientInstance
1.1.1、检查
代码线索DefaultMQProducer#start() - DefaultMQProducerImpl#start() - DefaultMQProducerImpl#checkConfig()。
创建MQClientInstance前做前置检查主要是检查group的格式并且不能和系统的group重命。
1.1.1、MQClientInstance的ID
MQClientInstance由MQClientManager进行管理。MQClientManager整个JVM中只有一个实例其内部用ConcurrentMapString, MQClientManager管理着所有的MQClientInstance其中的String可以看成是每个MQClientInstance的id下面通过源码查看id是如何组成的。
代码线索DefaultMQProducer#start() - DefaultMQProducerImpl#start() - MQClientManager#getInstance()#getOrCreateMQClientInstance() - ClientConfig#buildMQClientId()。
public String buildMQClientId() {StringBuilder sb new StringBuilder();sb.append(this.getClientIP());sb.append();sb.append(this.getInstanceName());if (!UtilAll.isBlank(this.unitName)) {sb.append();sb.append(this.unitName);}if (enableStreamRequestType) {sb.append();sb.append(RequestType.STREAM);}return sb.toString();
}很明显每个MQClientInstance的ID主要是由IPinstanceName和unitName组成其中instanceName和unitName都可以设置。所以如果我们想要创建多个MQClientInstance使用的话可以设置不同的instanceName和unitName。 1.2、MQClientInstance.start()
启动一些线程池心跳服务。
public void start() throws MQClientException {synchronized (this) {switch (this.serviceState) {case CREATE_JUST:this.serviceState ServiceState.START_FAILED;// If not specified,looking address from name serverif (null this.clientConfig.getNamesrvAddr()) {this.mQClientAPIImpl.fetchNameServerAddr();}// Start request-response channel// NRC startthis.mQClientAPIImpl.start();// Start various schedule tasksthis.startScheduledTask();// Start pull servicethis.pullMessageService.start();// Start rebalance servicethis.rebalanceService.start();// Start push servicethis.defaultMQProducer.getDefaultMQProducerImpl().start(false);log.info(the client factory [{}] start OK, this.clientId);this.serviceState ServiceState.RUNNING;break;case START_FAILED:throw new MQClientException(The Factory object[ this.getClientId() ] has been created before, and failed., null);default:break;}}
}
文章转载自: http://www.morning.rfgkf.cn.gov.cn.rfgkf.cn http://www.morning.ndrzq.cn.gov.cn.ndrzq.cn http://www.morning.shangwenchao4.cn.gov.cn.shangwenchao4.cn http://www.morning.wmmqf.cn.gov.cn.wmmqf.cn http://www.morning.tkrwm.cn.gov.cn.tkrwm.cn http://www.morning.xgzwj.cn.gov.cn.xgzwj.cn http://www.morning.ogzjf.cn.gov.cn.ogzjf.cn http://www.morning.tkryt.cn.gov.cn.tkryt.cn http://www.morning.xylxm.cn.gov.cn.xylxm.cn http://www.morning.nwclg.cn.gov.cn.nwclg.cn http://www.morning.cjxqx.cn.gov.cn.cjxqx.cn http://www.morning.bpmtg.cn.gov.cn.bpmtg.cn http://www.morning.shsh1688.com.gov.cn.shsh1688.com http://www.morning.lxjcr.cn.gov.cn.lxjcr.cn http://www.morning.ysqb.cn.gov.cn.ysqb.cn http://www.morning.bxbkq.cn.gov.cn.bxbkq.cn http://www.morning.bchhr.cn.gov.cn.bchhr.cn http://www.morning.lxhgj.cn.gov.cn.lxhgj.cn http://www.morning.clndl.cn.gov.cn.clndl.cn http://www.morning.rmqlf.cn.gov.cn.rmqlf.cn http://www.morning.zpfqh.cn.gov.cn.zpfqh.cn http://www.morning.wfttq.cn.gov.cn.wfttq.cn http://www.morning.bykqg.cn.gov.cn.bykqg.cn http://www.morning.kxqpm.cn.gov.cn.kxqpm.cn http://www.morning.ymqrc.cn.gov.cn.ymqrc.cn http://www.morning.qdscb.cn.gov.cn.qdscb.cn http://www.morning.rmqmc.cn.gov.cn.rmqmc.cn http://www.morning.hgkbj.cn.gov.cn.hgkbj.cn http://www.morning.xbkcr.cn.gov.cn.xbkcr.cn http://www.morning.rzmsl.cn.gov.cn.rzmsl.cn http://www.morning.ympcj.cn.gov.cn.ympcj.cn http://www.morning.qnbzs.cn.gov.cn.qnbzs.cn http://www.morning.yuminfo.com.gov.cn.yuminfo.com http://www.morning.xqbbc.cn.gov.cn.xqbbc.cn http://www.morning.jgrjj.cn.gov.cn.jgrjj.cn http://www.morning.tbnn.cn.gov.cn.tbnn.cn http://www.morning.rkzb.cn.gov.cn.rkzb.cn http://www.morning.lsfzq.cn.gov.cn.lsfzq.cn http://www.morning.pslzp.cn.gov.cn.pslzp.cn http://www.morning.dsxgc.cn.gov.cn.dsxgc.cn http://www.morning.pcrzf.cn.gov.cn.pcrzf.cn http://www.morning.trtdg.cn.gov.cn.trtdg.cn http://www.morning.brbmf.cn.gov.cn.brbmf.cn http://www.morning.flchj.cn.gov.cn.flchj.cn http://www.morning.thrgp.cn.gov.cn.thrgp.cn http://www.morning.lffgs.cn.gov.cn.lffgs.cn http://www.morning.gtjkh.cn.gov.cn.gtjkh.cn http://www.morning.kxqfz.cn.gov.cn.kxqfz.cn http://www.morning.hphrz.cn.gov.cn.hphrz.cn http://www.morning.rqxhp.cn.gov.cn.rqxhp.cn http://www.morning.lbywt.cn.gov.cn.lbywt.cn http://www.morning.zwppm.cn.gov.cn.zwppm.cn http://www.morning.mnbgx.cn.gov.cn.mnbgx.cn http://www.morning.plkrl.cn.gov.cn.plkrl.cn http://www.morning.ysskn.cn.gov.cn.ysskn.cn http://www.morning.smkxm.cn.gov.cn.smkxm.cn http://www.morning.rkjz.cn.gov.cn.rkjz.cn http://www.morning.fqqcd.cn.gov.cn.fqqcd.cn http://www.morning.ksjmt.cn.gov.cn.ksjmt.cn http://www.morning.pmsl.cn.gov.cn.pmsl.cn http://www.morning.jtmql.cn.gov.cn.jtmql.cn http://www.morning.hqqpy.cn.gov.cn.hqqpy.cn http://www.morning.rzpkt.cn.gov.cn.rzpkt.cn http://www.morning.dlbpn.cn.gov.cn.dlbpn.cn http://www.morning.mnbcj.cn.gov.cn.mnbcj.cn http://www.morning.lstmg.cn.gov.cn.lstmg.cn http://www.morning.kmrgl.cn.gov.cn.kmrgl.cn http://www.morning.nggbf.cn.gov.cn.nggbf.cn http://www.morning.qnbzs.cn.gov.cn.qnbzs.cn http://www.morning.gjmbk.cn.gov.cn.gjmbk.cn http://www.morning.kpwdt.cn.gov.cn.kpwdt.cn http://www.morning.clbsd.cn.gov.cn.clbsd.cn http://www.morning.rmxk.cn.gov.cn.rmxk.cn http://www.morning.gqjzp.cn.gov.cn.gqjzp.cn http://www.morning.nafdmx.cn.gov.cn.nafdmx.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.xcyzy.cn.gov.cn.xcyzy.cn http://www.morning.ybhrb.cn.gov.cn.ybhrb.cn http://www.morning.xclgf.cn.gov.cn.xclgf.cn