amqp

Celery design help: how to prevent concurrently executing tasks

◇◆丶佛笑我妖孽 提交于 2019-12-07 06:20:09
问题 I'm fairly new to Celery/AMQP and am trying to come up with a task/queue/worker design to meet the following requirements. I have multiple types of "per-user" tasks: e.g., TaskA, TaskB, TaskC. Each of these "per-user" tasks read/write data for one particular user in the system. So at any given time, I might need to create tasks User1_TaskA, User1_TaskB, User1_TaskC, User2_TaskA, User2_TaskB, etc. I need to ensure that, for each user , no two tasks of any task type execute concurrently. I want

How do I permanently remove a celery task from rabbitMQ?

眉间皱痕 提交于 2019-12-07 04:26:06
问题 I have around 10,000 scheduled tasks on my current celery setup. I didn't realize what scheduled tasks were and decided to use them to send follow-up emails months in advance. Looking back, it's probably never a good idea to schedule a task for more than 1 hour in the future as every time you restart a worker it has to re-receive every scheduled task from rabbitMQ and then they all just sit in the memory. My problem is that if I have to revoke a task, it doesn't just delete it. The task stays

三、RabbitMQ如何实现AMQ协议(读书笔记)

▼魔方 西西 提交于 2019-12-07 01:39:16
AMQP作为一种RPC传输机制 RabbitMQ作为一种AMPQ代理服务器,提供了一套严格的通信方式,核心部分的通信几乎都使用了RPC(远程过程调用)模式。 启动会话 AMQP协议定义,当客户端要与RabbitMQ交互时,首先要向RabbitMQ发送一个协议头(protocol header): 要完全连接到RabbitMQ,会经过由三个同步RPC请求所组成请求序列,这三个RPC请求分别是启动、调整和打开连接。对于应用RabbitMQ而言(不准备开发RabbitMQ Client),启动会话这个阶段并不是非常重要,稍作理解就好。 设置信道 AMQP协议定义,信道要使用AMQP连接作为互相传输信息的渠道,而且要将传输过程与其他正在进行中的会话隔离开。一个AMQP连接可以有多个信道,允许客户端和RabbitMQ之间进行多次会话,技术上称之为多路复用(multiplexing)。 不要使用过多的信道! 在传输过程中,信道只是分配给客户端和RabbitMQ之间所传递消息的一个整数值。但在客户端和RabbitMQ中,会为每个信道设置内存结构和对象,连接中的信道越多,用于管理该连接的消息流所需的内存也就越多。 AMQP RPC帧 AMQP使用类和方法在客户端和RabbitMQ之间创建公共语言,这些类和方法被称为AMQP命令(AMQP Commands)。AMQP中的类定义了一个功能范围

Dead letter exchange RabbitMQ dropping messages

可紊 提交于 2019-12-07 01:26:38
问题 I'm trying to implement a dlx queue in RabbitMQ. The scenario is quite easy I have 2 queues: 1) alive 2) dead (x-dead-letter-exchange: "immediate", x-message-ttl: 5000) and an exchange "immediate" that is bound to 1) alive I tried to run this example: http://blog.james-carr.org/2012/03/30/rabbitmq-sending-a-message-to-be-consumed-later/ but it seems that the messages are dropped after the ttl expires and they dont get published on the exchange, so my alive queue is always empty. I also tried

Unable to connect to Apache ActiveMQ with Node.js

冷暖自知 提交于 2019-12-06 16:11:20
Background Trying to connect to my Apache ActiveMQ broker using the AMQP 1.0 protocol via amqp10 . I am using the following code (adapted from the original example in the README): const AMQPClient = require("amqp10").Client; const Promise = require("bluebird"); //Fix from: https://github.com/noodlefrenzy/node-amqp10/issues/241 const activeMQPolicy = require("amqp10").Policy; const client = new AMQPClient(activeMQPolicy.ActiveMQ); const setUp = () => { return Promise.all([ client.createReceiver("amq.topic"), client.createSender("amq.topic") ]); }; client.connect("amqp://localhost") .then(setUp)

Expired Message Delivery Sequence RabbitMQ

萝らか妹 提交于 2019-12-06 14:48:06
We are building a solution in which we are publishing message to a time-out queue. After TTL expiry messages are pushed to main queue for re-processing. We are setting up counter value so that messages will be tried for x no. of times for the redelivery. Solution is working fine. But the scenario is when the message on the head position is highest TTL is not expired, other messages of lower expiry will not be re-published (to main queue). Is this understanding correct ? If Yes what is the solution so that each message re-processed just after TTL. Appreciating answers / viewpoint. Thanks. If

RabbitMQ入门详解以及使用

旧时模样 提交于 2019-12-06 14:40:13
目的:     RabbitMQ 简介    RabbitMQ 安装及使用       Centos安装       Docker安装 (今天选择Docker安装方法)    RabbitMQ 快速入门    交换机 RabbitMQ简介 各大主流中间件对比    ActiveMQ 是 Apache 出品,最流行的,能力强劲的开源消息总线,并且它一 个完全支持 J M S 规范的消息中间件。 其丰富的 API 、多种集群构建模式使得他成为业界老牌消息中间件,在中 小型企业中应用广泛! MQ 衡量指标:服务性能、数据存储、集群架构 Kafka: RocketMQ 是阿里开源的消息中间件,目前也已经孵化为 Apache 顶级项目, 它是纯 java 开发,具有高吞吐量、高可用性、适合大规模分布式系统 应用的特点。 RocketMQ 思路起源于 Kafka, 它对消息的可靠传输及事务 性做了优化, 目前在阿里集团被广泛应用于交易、充值、流计算、消息推 送、日志流式处理、 binglog 分发等场景 RabbitMQ 是使用 Erlang 语言开发的开源消息队列系统,基于 AMQP 协议 来实现。 AMQP 的主要特征是面向消息、队列、路由(包括点对点和发布 / 订阅)、可靠性、安全。 AMQP 协议更多用在企业系统内, 对数据 _ 致 性、稳定性和可靠性要求很髙的场景

Kafka初识

亡梦爱人 提交于 2019-12-06 14:22:36
转载自 https://www.cnblogs.com/luotianshuai/p/5206662.html Kafka初识 1、Kafka使用背景 在我们大量使用分布式数据库、分布式计算集群的时候,是否会遇到这样的一些问题: 我们想分析下用户行为(pageviews),以便我们设计出更好的广告位 我想对用户的搜索关键词进行统计,分析出当前的流行趋势 有些数据,存储数据库浪费,直接存储硬盘效率又低 这些场景都有一个共同点: 数据是由上游模块产生,上游模块,使用上游模块的数据计算、统计、分析,这个时候就可以使用消息系统,尤其是分布式消息系统! 2、Kafka的定义 What is Kafka:它是一个分布式消息系统,由linkedin使用scala编写,用作LinkedIn的活动流(Activity Stream)和运营数据处理管道(Pipeline)的基础。具有高水平扩展和高吞吐量。 3、Kafka和其他主流分布式消息系统的对比 定义解释: 1、Java 和 scala都是运行在JVM上的语言。 2、erlang和最近比较火的和go语言一样是从代码级别就支持高并发的一种语言,所以RabbitMQ天生就有很高的并发性能,但是 有RabbitMQ严格按照AMQP进行实现,受到了很多限制。kafka的设计目标是高吞吐量,所以kafka自己设计了一套高性能但是不通用的协议

RabbitMQ

心不动则不痛 提交于 2019-12-06 14:01:22
1、RabbitMQ简介 2、RabbitMQ安装及使用 3、RabbitMQ快速入门 4、交换机 RabbitMQ 简介 各大主流中间件对比 ActiveMQ 是 Apache 出品,最流行的,能力强劲的开源消息总线,并且它一 个完全支持 J M S 规范的消息中间件。 其丰富的 API 、多种集群构建模式使得他成为业界老牌消息中间件,在中 小型企业中应用广泛! MQ 衡量指标:服务性能、数据存储、集群架构 RocketMQ是阿里开源的消息中间件,目前也已经孵化为Apache顶级项目, 它是纯java开发,具有高吞吐量、高可用性、适合大规模分布式系统 应用的特点。 RocketMQ思路起源于Kafka,它对消息的可靠传输及事务 性做了优化, 目前在阿里集团被广泛应用于交易、充值、流计算、消息推 送、日志流式处理、binglog分发等场景 RabbitMQ是使用Erlang语言开发的开源消息队列系统,基于AMQP协议 来实现。 AMQP的主要特征是面向消息、队列、路由(包括点对点和发布 /订阅)、可靠性、安全。AMQP协议更多用在企业系统内, 对数据_致 性、稳定性和可靠性要求很髙的场景,对性能和吞吐量的要求还在其次。 结论: activiMq老牌消息中间件,api全面,但是吞吐量不大 Kafaka吞吐量大,但是数据无法保证不丢失,主要面向大数据 rokectMQ:吞吐量大

Celery Why Does Task Stay In Queue

那年仲夏 提交于 2019-12-06 14:00:51
问题 So I am using Celery with RabbitMQ. I have a RESTful API that registers a user. I am using remote Celery worker to send a registration email asynchronously so my API can return fast response. from .tasks import send_registration_email def register_user(user_data): # save user to the database etc send_registration_email.delay(user.id) return {'status': 'success'} This works fine. Email is being sent in a non blocking asynchronous way (and can be retried if fails which is cool). The problem is