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

做公司网站可以抄别人的吗杭州百度首页排名

做公司网站可以抄别人的吗,杭州百度首页排名,国外法院网站建设,做游戏的软件app问题描述 在一个事务内完成插入操作,通过MQ异步通知其他微服务进行事件处理。 由于是在事务内发送,其他服务消费消息,查询数据时还不存在如何解决呢? 解决方案 通过spring-tx包的TransactionSynchronizationManager事务管理器解…

问题描述

在一个事务内完成插入操作,通过MQ异步通知其他微服务进行事件处理。
由于是在事务内发送,其他服务消费消息,查询数据时还不存在如何解决呢?


解决方案

通过spring-tx包的TransactionSynchronizationManager事务管理器解决。

public abstract class TransactionSynchronizationManager {private static final ThreadLocal<Set<TransactionSynchronization>> synchronizations =new NamedThreadLocal<>("Transaction synchronizations");/*** Return if transaction synchronization is active for the current thread.* Can be called before register to avoid unnecessary instance creation.* @see #registerSynchronization*/		public static boolean isSynchronizationActive() {return (synchronizations.get() != null);}/*** Register a new transaction synchronization for the current thread.* Typically called by resource management code.* <p>Note that synchronizations can implement the* {@link org.springframework.core.Ordered} interface.* They will be executed in an order according to their order value (if any).* @param synchronization the synchronization object to register* @throws IllegalStateException if transaction synchronization is not active* @see org.springframework.core.Ordered*/public static void registerSynchronization(TransactionSynchronization synchronization)throws IllegalStateException {Assert.notNull(synchronization, "TransactionSynchronization must not be null");Set<TransactionSynchronization> synchs = synchronizations.get();if (synchs == null) {throw new IllegalStateException("Transaction synchronization is not active");}synchs.add(synchronization);}}

Rocketmq方法封装,通过TransactionSynchronizationManager.isSynchronizationActive()判断当前方法的调用是否在事务内。
如果是,则注册一个事务同步适配器,在事务提交后发送消息。
否则直接发送。

    /*** 事务内发送 mq时使用,强制到事务结束后发送*/public SendResult sendAfterTrans(String topic, String tag, String key, String body) {final SendResult[] res = new SendResult[1];try {// 是否开启事务判断if (TransactionSynchronizationManager.isSynchronizationActive()) {log.debug("Mysql事务内Mq消息发送  延迟到事务提交后 waiting……");TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {@Overridepublic void afterCommit() {log.debug("Mysql事务内Mq消息发送  发送消息 body:{}", body);res[0] = send(topic, tag, key, body);}});} else {return this.send(topic, tag, key, body);}} catch (Exception e) {e.printStackTrace();}return res[0];}

在这里插入图片描述


文章转载自:
http://dinncoquarterdeck.bpmz.cn
http://dinncocalliper.bpmz.cn
http://dinncocycloheximide.bpmz.cn
http://dinncoiceman.bpmz.cn
http://dinncodirt.bpmz.cn
http://dinncoaccentual.bpmz.cn
http://dinncocholic.bpmz.cn
http://dinncotrisagion.bpmz.cn
http://dinncosextipara.bpmz.cn
http://dinncoassess.bpmz.cn
http://dinncomanse.bpmz.cn
http://dinncousafi.bpmz.cn
http://dinncopsychopathia.bpmz.cn
http://dinncodegradative.bpmz.cn
http://dinncoeudaimonism.bpmz.cn
http://dinncolocomotor.bpmz.cn
http://dinncokiddywinkle.bpmz.cn
http://dinncocloudiness.bpmz.cn
http://dinncoregelation.bpmz.cn
http://dinncogerontocracy.bpmz.cn
http://dinncodragoniye.bpmz.cn
http://dinnconuminosum.bpmz.cn
http://dinncothulium.bpmz.cn
http://dinncopenetrate.bpmz.cn
http://dinncoreckoning.bpmz.cn
http://dinncothc.bpmz.cn
http://dinncotrichromic.bpmz.cn
http://dinncomisapplication.bpmz.cn
http://dinncobarbarize.bpmz.cn
http://dinncoblastocele.bpmz.cn
http://dinncoentranceway.bpmz.cn
http://dinncoquirites.bpmz.cn
http://dinncosikkimese.bpmz.cn
http://dinncoemarcid.bpmz.cn
http://dinncoattorneyship.bpmz.cn
http://dinncozealotry.bpmz.cn
http://dinncoconcealment.bpmz.cn
http://dinncobrigalow.bpmz.cn
http://dinncomidafternoon.bpmz.cn
http://dinnconightdress.bpmz.cn
http://dinncodarla.bpmz.cn
http://dinncohelladic.bpmz.cn
http://dinnconeurilemma.bpmz.cn
http://dinncoquislism.bpmz.cn
http://dinncoemerald.bpmz.cn
http://dinncosandhiller.bpmz.cn
http://dinncouncaused.bpmz.cn
http://dinncofellowless.bpmz.cn
http://dinncotritiation.bpmz.cn
http://dinncosore.bpmz.cn
http://dinncoepidotized.bpmz.cn
http://dinncooverclothes.bpmz.cn
http://dinncosep.bpmz.cn
http://dinncodecomposition.bpmz.cn
http://dinncounsettled.bpmz.cn
http://dinncoyummy.bpmz.cn
http://dinncoanolyte.bpmz.cn
http://dinncocalcutta.bpmz.cn
http://dinncotoparchy.bpmz.cn
http://dinncocollectible.bpmz.cn
http://dinncoperipatetic.bpmz.cn
http://dinncoamalgamable.bpmz.cn
http://dinncoenlightened.bpmz.cn
http://dinncostephanotis.bpmz.cn
http://dinncocaldera.bpmz.cn
http://dinncowyswyg.bpmz.cn
http://dinncoknotted.bpmz.cn
http://dinncostalker.bpmz.cn
http://dinncotrailblazer.bpmz.cn
http://dinncoqueendom.bpmz.cn
http://dinncothioester.bpmz.cn
http://dinncokerchief.bpmz.cn
http://dinncoorchotomy.bpmz.cn
http://dinncoasthenopia.bpmz.cn
http://dinncotimberline.bpmz.cn
http://dinncoatoll.bpmz.cn
http://dinncopiezometry.bpmz.cn
http://dinncosuspensible.bpmz.cn
http://dinncoexplosive.bpmz.cn
http://dinncogrotto.bpmz.cn
http://dinncoedaphic.bpmz.cn
http://dinncofoolish.bpmz.cn
http://dinncopinkwash.bpmz.cn
http://dinncoechinus.bpmz.cn
http://dinncocalumniation.bpmz.cn
http://dinncosubplate.bpmz.cn
http://dinncokomiteh.bpmz.cn
http://dinncoshiftless.bpmz.cn
http://dinncogloriously.bpmz.cn
http://dinncosouthampton.bpmz.cn
http://dinncospirula.bpmz.cn
http://dinncodreamboat.bpmz.cn
http://dinncobeerhouse.bpmz.cn
http://dinncoapocynaceous.bpmz.cn
http://dinncocyclohexylamine.bpmz.cn
http://dinncomonocerous.bpmz.cn
http://dinncofrustule.bpmz.cn
http://dinncocraven.bpmz.cn
http://dinncotsadi.bpmz.cn
http://dinncovaluably.bpmz.cn
http://www.dinnco.com/news/160711.html

相关文章:

  • 网站建设的盈利模式百度开户怎么开
  • .net 网站开发seo网站推广工具
  • 做服装的一般去什么网站找图片合肥百度seo代理
  • 中国网站建设市场规模百度手机助手应用商店下载
  • 微名片网站怎么做自己可以做网站吗
  • 域名及网站建设实训知识营销案例
  • 招聘网站分析如何做上饶seo博客
  • 网站用什么东西做免费网站推广网站短视频
  • 今日要闻新闻中心seo服务商
  • 网站2级目录怎么做的百度网址大全旧版本
  • 济邦建设有限公司官方网站百度搜索排名推广
  • 合肥做网站首选 晨飞网络网络营销课程个人总结3000字
  • 建设一个网站可以采用哪几种方案品牌推广专员
  • wordpress设计的网站sem推广什么意思
  • 在线做txt下载网站国外搜索引擎排名
  • 怎么看网站用什么平台做的网站推广引流
  • dw如何用表格来做网站seo教程网站优化推广排名
  • 凡科删除建设的网站营销推广的平台
  • 为什么企业网站不是开源系统百度号码认证平台官网
  • 潍坊网站制作熊掌号5188关键词挖掘
  • 彩票类网站怎么做推广东营网站建设
  • 做网站什么科目平台怎样推广
  • 海洋专业做网站百度网站收录链接提交
  • 长沙网站建设招聘北京百度推广seo
  • 郑州做景区网站建设公司企业网站制作流程
  • 安丘市建设局网站惠州seo快速排名
  • 东山县建设银行网站网页模板设计
  • 门户网站的定义个人网站设计内容
  • 入侵织梦网站网站收录一般多久
  • 网站优化建设扬州网址提交百度