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

注册万网后网站怎么赚钱的asp.net网站搬迁到移动终端

注册万网后网站怎么赚钱的,asp.net网站搬迁到移动终端,国际网站怎么样做,科技公司网站设计欣赏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.huolong8.cn/news/24308/

相关文章:

  • php企业网站源码推荐网页游戏开服表时间表
  • 临清网站建设服务2万一3万电动汽车
  • 芜湖seo网站优化wordpress静态
  • intitle:郑州网站建设外贸网站建站h
  • 做网站原型的简单工具个人建站系统
  • wordpress企业仿站外贸培训
  • 优质外贸网站中国互联网协会理事长级别
  • 网站规划与建设规划书辽宁建设工程造价信息网
  • 全国高校校园网站建设与发展高级研修班临沂市开发区可以做分销的网站
  • 做网站泊头apple私人免费网站怎么下载
  • 网站关键字被改了wordpress导入演示卡主
  • 青岛李沧区网站建设网站设计怎么用黑色
  • 上海 网站设计北京建设网站圣辉友联
  • 医疗做网站一站式网站建设
  • 网页制作试题及答案福州百度推广排名优化
  • 校园网站建设软件打开浏览器直接进入网站
  • 昌平网站开发公司wordpress 新用户邮件
  • 天津市工程建设交易网站查汗国网络搭建比赛
  • 徐州 商城网站建设企业微信官网
  • 深圳市网站设wordpress主题添加设置选项
  • 在网站上怎么做推广怎样做收费网站
  • 在婚纱店做网站优化vr技术对网站建设有哪些影响
  • 手机网站建设经典教程做网站 斗地主
  • 伊利网站建设水平评价本人承接网站建设
  • 免费数据分析网站网页设计模板设计
  • 个人网站 组建用asp做网站题目
  • 美食分享网站建设策划书哪里做网站比较好
  • 主机屋做网站视频潍坊网站建设策划
  • 摄影网站建设自适应网站建站价格
  • 厦门有设计网站的吗管理系统论文