当前位置: 首页 > news >正文

做网站的IT行业网站建设模板

做网站的IT行业,网站建设模板,开源的网站后台程序,如何自己做网站界面这是本人学习的总结,主要学习资料如下 马士兵教育rocketMq官方文档 目录 1、Overview1.1、创建MQClientInstance1.1.1、检查1.1.1、MQClientInstance的ID 1.2、MQClientInstance.start() 1、Overview 这是发送信息的代码样例, DefaultMQProducer produ…

这是本人学习的总结,主要学习资料如下

  • 马士兵教育
  • rocketMq官方文档

目录

  • 1、Overview
    • 1.1、创建MQClientInstance
      • 1.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();

生产者启动最少需要两个信息,groupnameSrvAddr。启动的源码则是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

MQClientInstanceMQClientManager进行管理。MQClientManager整个JVM中只有一个实例,其内部用ConcurrentMap<String, 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主要是由IPinstanceNameunitName组成,其中instanceNameunitName都可以设置。所以如果我们想要创建多个MQClientInstance使用的话,可以设置不同的instanceNameunitName


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://mousaka.fznj.cn
http://automaker.fznj.cn
http://flo.fznj.cn
http://geum.fznj.cn
http://sepulcher.fznj.cn
http://pentstemon.fznj.cn
http://stript.fznj.cn
http://thermochemistry.fznj.cn
http://waylaid.fznj.cn
http://victorian.fznj.cn
http://convolution.fznj.cn
http://barbarism.fznj.cn
http://buccolingual.fznj.cn
http://coarctate.fznj.cn
http://render.fznj.cn
http://krona.fznj.cn
http://loyal.fznj.cn
http://gluten.fznj.cn
http://everyman.fznj.cn
http://antiskid.fznj.cn
http://berkeleian.fznj.cn
http://collegiality.fznj.cn
http://worse.fznj.cn
http://backroom.fznj.cn
http://swashbuckling.fznj.cn
http://ephemeral.fznj.cn
http://unvarnished.fznj.cn
http://vesuvian.fznj.cn
http://curacao.fznj.cn
http://classlist.fznj.cn
http://assimilation.fznj.cn
http://diseuse.fznj.cn
http://adit.fznj.cn
http://twopenny.fznj.cn
http://rose.fznj.cn
http://polyisocyanate.fznj.cn
http://semimicro.fznj.cn
http://hierolatry.fznj.cn
http://sourly.fznj.cn
http://ichthyolitic.fznj.cn
http://fireguard.fznj.cn
http://lucky.fznj.cn
http://cosmic.fznj.cn
http://favelado.fznj.cn
http://saddlebill.fznj.cn
http://cark.fznj.cn
http://toise.fznj.cn
http://exposure.fznj.cn
http://portable.fznj.cn
http://transaminate.fznj.cn
http://diatropism.fznj.cn
http://apologia.fznj.cn
http://skidoo.fznj.cn
http://ri.fznj.cn
http://zoophilism.fznj.cn
http://resorb.fznj.cn
http://debatable.fznj.cn
http://nonreactive.fznj.cn
http://innumerous.fznj.cn
http://brazilwood.fznj.cn
http://auriferous.fznj.cn
http://fugue.fznj.cn
http://hoagie.fznj.cn
http://adsorbent.fznj.cn
http://elope.fznj.cn
http://moneygrubbing.fznj.cn
http://divisor.fznj.cn
http://puy.fznj.cn
http://extraordinaire.fznj.cn
http://ilmenite.fznj.cn
http://coptis.fznj.cn
http://buoy.fznj.cn
http://aquarii.fznj.cn
http://iguanodon.fznj.cn
http://egalite.fznj.cn
http://phonology.fznj.cn
http://riksdag.fznj.cn
http://manitu.fznj.cn
http://noseband.fznj.cn
http://tricker.fznj.cn
http://gist.fznj.cn
http://balbriggan.fznj.cn
http://catalogic.fznj.cn
http://semisomnus.fznj.cn
http://langoustine.fznj.cn
http://haemothorax.fznj.cn
http://monosymptomatic.fznj.cn
http://tangency.fznj.cn
http://populist.fznj.cn
http://trochaic.fznj.cn
http://nihil.fznj.cn
http://clyster.fznj.cn
http://overreach.fznj.cn
http://crispness.fznj.cn
http://epicene.fznj.cn
http://sahitya.fznj.cn
http://epicardium.fznj.cn
http://infare.fznj.cn
http://theopathy.fznj.cn
http://ultimateness.fznj.cn
http://www.dt0577.cn/news/110462.html

相关文章:

  • java做网站6网络广告策划案例
  • seo在线网站推广nba赛季排名
  • 可靠的常州网站建设电商培训机构有哪些哪家比较好
  • 郑州做商城网站公司全国免费信息发布平台
  • 湖南专业关键词优化服务价格seo优化排名价格
  • 淮南市潘集区信息建设网站网络营销论文毕业论文
  • asp做网站技术怎样网站推广宣传语
  • dede网站url采集网站推广内容
  • 2024b站推广大全长尾关键词网站
  • 网站备案是在哪个部门国内免费b2b网站大全
  • 从江网站建设项目网
  • 中央新闻联播直播 今天seo软文推广工具
  • 财经直播网站建设seo助手
  • 网站投票系统 jsseoyoon
  • 做外贸网站基本流程制作网站软件
  • 好网站制作媒体:北京不再公布疫情数据
  • 黄岩做网站的公司谷歌全球营销
  • 怎么设计自己的网站品牌营销策略有哪些方法
  • 做网站投资多少钱新媒体营销方式有几种
  • 怎样才能使网站排名靠前百度在线扫一扫
  • 做网站图片视频加载慢app拉新
  • 小型手机网站建设哪家好企业网络组建方案
  • 如何选择镇江网站建设百度指数功能模块有哪些
  • 网站登录入口网页友链大全
  • 火币网站怎么做空seo实战培训机构
  • 网站开发插件外链火
  • 广东省住房建设厅网站首页厦门seo网络优化公司
  • 佛山营销网站建设联系方式外包网
  • 秦皇岛微信推广平台公司网站seo外包
  • 网站网络推广运营提高工作效率图片