amqp

Microservice, amqp and service registry / discovery

为君一笑 提交于 2020-01-23 06:24:25
问题 I m studying Microservices architecture and I m actually wondering something. I m quite okay with the fact of using (back) service discovery to make request able on REST based microservices. I need to know where's the service (or at least the front of the server cluster) to make requests. So it make sense to be able to discover an ip:port in that case. But I was wondering what could be the aim of using service registry / discovery when dealing with AMQP (based only, without HTTP possible

一文搞定,RabbitMQ 从初识到精通

时间秒杀一切 提交于 2020-01-21 00:23:19
MQ消息中间件,这几年逐渐火爆起来,用处越来越多, 消息、削峰限流等 。MQ一般遵循AMQP协议。AMQP,即Advanced Message Queuing Protocol,一个提供统一消息服务的应用层标准高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计。 基于此协议的客户端与消息中间件可传递消息,并不受客户端/中间件不同产品,不同的开发语言等条件的限制。 当前市面上常见的MQ有,ActiveMQ、RabbitMQ、Kafka、RocketMQ等。她们中有标准的MQ(遵循AMQP协议,如RabbitMQ),也有非标准的MQ(如Kafka)。 一、RabbitMQ 简介 RabbitMQ是一个开源的AMQP实现,服务器端用Erlang语言编写,支持多种客户端,如:Python、Ruby、.NET、Java、JMS、C、PHP、ActionScript、XMPP、STOMP等,支持AJAX。用于在分布式系统中存储转发消息,在易用性、扩展性、高可用性等方面表现不俗。RabbitMQ有如下特点, 可靠性 (Reliability),RabbitMQ 使用一些机制来保证可靠性,如 持久化、传输确认、发布确认 。 灵活的路由 (Flexible Routing),在消息进入队列之前,通过 Exchange 来路由消息的。 消息集群 (Clustering),多个

RabbitMQ安装与原理详解

人走茶凉 提交于 2020-01-18 02:40:32
文章目录 一、概述 1. 什么是消息队列 2. 为什么要使用消息队列 3. RabbitMQ特点 二、安装 1. 安装Erlang 2. 安装RabbitMQ 三、RabbitMQ 1. 启动和关闭 2. 插件管理 3. 用户管理 4. 权限管理 5. vhost管理 6. 设置管理员权限 四、消息发送和接收 1. RabbitMQ消息发送和接收机制 2. AMQP 中的消息路由 3. Exchange与Queue关联绑定 4. Exchange 类型 (1)direct (2)fanout (3)topic 5. Client与Brocker进行连接 五、RabbitMQ镜像集群 1. 准备 2. 配置Cookie文件 3. 配置hosts文件 4. 组建集群 5. 节点类型 一、概述 1. 什么是消息队列 消息(Message)是指在应用间传送的数据。消息可以非常简单,比如只包含文本字符串,也可以更复杂,可能包含嵌入对象。 消息队列(Message Queue)是一种应用间的通信方式,消息发送后可以立即返回,由消息系统来确保消息的可靠传递。消息发布者只管把消息发布到 MQ 中而不用管谁来取,消息使用者只管从 MQ 中取消息而不管是谁发布的。这样发布者和使用者都不用知道对方的存在。 2. 为什么要使用消息队列 从上面的描述中可以看出消息队列是一种应用间的 异步协作机制

celery --分布式任务队列

一曲冷凌霜 提交于 2020-01-16 08:51:17
celery --分布式任务队列 一、介绍 celery是一个基于python开发的分布式异步消息任务队列,用于处理大量消息,同时为操作提供维护此类系统所需的工具。 它是一个任务队列,专注于实时处理,同时还支持任务调度。如果你的业务场景中需要用到异步任务,就可以考虑使用celery 二、实例场景 1、你想对100台机器执行一条批量命令,可能会花很长时间 ,但你不想让你的程序等着结果返回,而是给你返回 一个任务ID,你过一段时间只需要拿着这个任务id就可以拿到任务执行结果, 在任务执行ing进行时,你可以继续做其它的事情。 2、你想做一个定时任务,比如每天检测一下你们所有客户的资料,如果发现今天 是客户的生日,就给他发个短信祝福 三、优点 1、简单:一但熟悉了celery的工作流程后,配置和使用还是比较简单的 2、高可用:当任务执行失败或执行过程中发生连接中断,celery 会自动尝试重新执行任务 3、快速:一个单进程的celery每分钟可处理上百万个任务 4、灵活:几乎celery的各个组件都可以被扩展及自定制 四、入门 celery 需要一个解决方案来发送和接受消息,通常,这是以称为消息代理的单独服务的形式出现的 有以下几种解决方案,包括: 一:RabbitMQ(消息队列,一种程序之间的通信方式) rabbitmq 功能齐全,稳定,耐用且易于安装。它是生产环境的绝佳选择。

Why does basicReject does not work with Apache Qpid?

a 夏天 提交于 2020-01-15 09:27:13
问题 I'm using qpid-broker for integration testing my spring-boot-start-amqp application which uses basicGet (autoAck=false), basicAck and basicReject for handling the messages. basicReject (with requeue=false) works fine with my external rabbitmq instance but doesn't work with the qpid-broker . I have tested my code with an external RabbitMQ instance where everything works fine but with the embedded Apache Qpid server the test fails because basicReject is not working properly. Getting the message

Why does basicReject does not work with Apache Qpid?

会有一股神秘感。 提交于 2020-01-15 09:26:27
问题 I'm using qpid-broker for integration testing my spring-boot-start-amqp application which uses basicGet (autoAck=false), basicAck and basicReject for handling the messages. basicReject (with requeue=false) works fine with my external rabbitmq instance but doesn't work with the qpid-broker . I have tested my code with an external RabbitMQ instance where everything works fine but with the embedded Apache Qpid server the test fails because basicReject is not working properly. Getting the message

Spring Boot中使用RabbitMQ

折月煮酒 提交于 2020-01-15 05:50:36
很久没有写Spring Boot的内容了,正好最近在写Spring Cloud Bus的内容,因为内容会有一些相关性,所以先补一篇关于AMQP的整合。 Message Broker与AMQP简介 Message Broker是一种消息验证、传输、路由的架构模式,其设计目标主要应用于下面这些场景: 消息路由到一个或多个目的地 消息转化为其他的表现方式 执行消息的聚集、消息的分解,并将结果发送到他们的目的地,然后重新组合相应返回给消息用户 调用Web服务来检索数据 响应事件或错误 使用发布-订阅模式来提供内容或基于主题的消息路由 AMQP是Advanced Message Queuing Protocol的简称,它是一个面向消息中间件的开放式标准应用层协议。AMQP定义了这些特性: 消息方向 消息队列 消息路由(包括:点到点和发布-订阅模式) 可靠性 安全性 RabbitMQ 本文要介绍的RabbitMQ就是以AMQP协议实现的一种中间件产品,它可以支持多种操作系统,多种编程语言,几乎可以覆盖所有主流的企业级技术平台。 安装 详情见《 安装RabbitMQ 》 Rabbit管理 我们可以直接通过配置文件的访问进行管理,也可以通过Web的访问进行管理。下面我们将介绍如何通过Web进行管理。 执行 rabbitmq-plugins.bat enable rabbitmq

What happens to fetched messages when RabbitMQ consumer crashes?

谁都会走 提交于 2020-01-14 09:53:06
问题 If I have a RabbitMQ consumer that retrieves 100 messages in bulk, but then it crashes before it can mark those messages as processed, are those messages lost? I want every message in the queue to be processed at least once. What's the recommended approach to deal with consumers that crash before they've acknowledged messages? Does RabbitMQ put them back on the queue somehow, or what do I need to do to make it happen? 回答1: What's the recommended approach to deal with consumers that crash

Unable to “Peek” messages from an Azure Service Bus Queue using AMQP and Node [duplicate]

女生的网名这么多〃 提交于 2020-01-14 03:22:27
问题 This question already has an answer here : Getting “amqp:internal-error” when peeking messages from Azure Service Bus Queue using AMQP, rhea and Node (1 answer) Closed 2 years ago . I'm trying to "Peek" messages from an Azure Service Bus queue using nodeamqp10 library but unfortunately I am not able to do so. Here's the code I am using: const AMQPClient = require('amqp10/lib').Client, Policy = require('amqp10/lib').Policy; const protocol = 'amqps'; const keyName = 'MyPolicy'; const sasKey =

Rabbitmq message arrival time stamp

泄露秘密 提交于 2020-01-13 08:35:47
问题 Is there a way to get the timestamp when a message was placed on the queue, from a consumer. Not when it was published, but when it actually made it to the queue. 回答1: No there's no way to figure this out, unless, as you state yourself you write a plugin for this. There is nothing in the AMQP specification that says that the message must know when it arrived in the queue. There is no need from the AMQP point of view to know this. There are also many cases when the message might pass through