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

公司网站建设模板免费一个完整的网站 技术

公司网站建设模板免费,一个完整的网站 技术,成都装修设计公司排名,引擎seo优2019独角兽企业重金招聘Python工程师标准 通过Publisher Confirms and Returns机制#xff0c;生产者可以判断消息是否发送到了exchange及queue#xff0c;而通过消费者确认机制#xff0c;Rabbitmq可以决定是否重发消息给消费者#xff0c;以保证消息被处理… 2019独角兽企业重金招聘Python工程师标准 通过Publisher Confirms and Returns机制生产者可以判断消息是否发送到了exchange及queue而通过消费者确认机制Rabbitmq可以决定是否重发消息给消费者以保证消息被处理。 1.什么是Publisher Confirms and Returns Delivery processing acknowledgements from consumers to RabbitMQ are known as acknowledgements in AMQP 0-9-1 parlance; broker acknowledgements to publishers are a protocol extension called publisher confirms.  地址http://www.rabbitmq.com/confirms.html 根据RabbitMq官网定义rabbitmq代理(broker)对发布者(publishers)的确认被称作发布者确认(publisher confirms)这种机制是Rabbitmq对标准Amqp协议的扩展。因此通过这种机制可以确认消息是否发送给了目标。 2.如何通过Spring amqp来使用Publisher Confirms and Returns机制 Confirmed and returned messages are supported by setting the CachingConnectionFactory’s publisherConfirms and publisherReturns properties to ‘true’ respectively.When these options are set, Channel s created by the factory are wrapped in an PublisherCallbackChannel, which is used to facilitate the callbacks. When such a channel is obtained, the client can register a PublisherCallbackChannel.Listener with the Channel. The PublisherCallbackChannel implementation contains logic to route a confirm/return to the appropriate listener. These features are explained further in the following sections. http://docs.spring.io/spring-amqp/docs/1.6.3.RELEASE/reference/html/_reference.html#cf-pub-conf-ret 通过Spring amqp文档可以看到要使用这种机制需要将Template模版的设publisherConfirms 或publisherReturns 属性设置为true此外ConnectionFactory要配置为CachingConnectionFactory。 bean idconnectionFactoryclassorg.springframework.amqp.rabbit.connection.CachingConnectionFactoryproperty namehost value192.168.2.133 /property nameport value5672 /property nameusername valuesun /property namepassword value123456 /property namepublisherConfirms valuetrue /property namepublisherReturns valuetrue //bean 2.1 ConfirmCallback的使用及触发的一种场景 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.support.CorrelationData; import org.springframework.stereotype.Service;/*** author wangzhongqiu* Created on 2017/10/31.* description:继承RabbitTemplate.ConfirmCallback,消息确认监听器*/ Service public class ConfirmCallBackListener implements RabbitTemplate.ConfirmCallback {private Logger log LoggerFactory.getLogger(CommonProducer.class);Overridepublic void confirm(CorrelationData correlationData, boolean ack, String cause) {log.info(收到回调成功发送到broker);} } 2.2 ReturnCallback的使用及触发的一种场景 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.stereotype.Service;/*** author wangzhongqiu* Created on 2017/10/31.* description:继承RabbitTemplate.ReturnCallback,消息发送失败返回监听器*/ Service public class ReturnCallBackListener implements RabbitTemplate.ReturnCallback {private Logger log LoggerFactory.getLogger(CommonProducer.class);Overridepublic void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {log.info(收到回调);log.info(return--message: new String(message.getBody()) ,replyCode: replyCode ,replyText: replyText ,exchange: exchange ,routingKey: routingKey);} } 使用场景 如果消息没有到exchange,则confirm回调,ackfalse 如果消息到达exchange,则confirm回调,acktrue exchange到queue成功,则不回调return exchange到queue失败,则回调return(需设置mandatorytrue,否则不回回调,消息就丢了) 转载于:https://my.oschina.net/xiaominmin/blog/1811701
http://www.pierceye.com/news/89156/

相关文章:

  • 官方网站建设源码系统昨天正常的网站突然显示建设中
  • 大麦网建设网站的功能定位app安装官方免费下载
  • 南宁做网站开发的公司有哪些app软件下载网站源码
  • 刷赞抖音推广网站asp影视网站源码
  • 北京网站建设龙鹏php做网站需要注意什么
  • wordpress简易主题网站关键词在线优化
  • 银川网站建设哪家价格低别人做的网站自己根目录吗
  • app网站建站系统下载dedecms网站迁移
  • 最新的网站建设软件申请注册公司需要多少钱
  • qwins是哪个网站做的去掉wordpress标题中竖线
  • 为什么要学电商网站建设系统网站推广方案怎么做
  • 电商网站运营方案太原seo管理
  • 易思espcms企业网站管理系统腾讯竞价广告
  • 设计网站网站名称怎么制作网站程序
  • 销售型企业网站有哪些二级医院做网站
  • 南昌网站建设公司网站建设公司哪家好查关键词排名
  • 网站建设怎么自学iis7配置asp网站
  • 福建永安建设局网站深圳网站营销推广公司
  • 公司网站找谁做爱空间家装公司电话
  • 哪些网站用黑体做的商城网站系统
  • WordPress找不到站点昌平网站建设
  • 源码管理 网站做爰的网站
  • 移动电子商务网站设计做外贸网站效果好吗
  • 做民宿需要和多家网站合作吗如何编辑公众号
  • 长沙做网站推荐有口碑的江苏网站建设
  • 上海网站建设公司 红威跨境电商平台有哪些上市公司
  • 网站建设做网站需要多少钱?不用dw怎么做网站
  • 如何建立一个私人网站餐馆建设网站的目的是什么
  • 网站后台功能技术要求西安网站排名优化培训
  • 万网建设网站教程cvv钓鱼网站怎么做