pika

Pika blocking_connection.py random timeout connecting to RabbitMQ

对着背影说爱祢 提交于 2019-12-01 06:39:43
i have a rabbit mq running on machine both client and rabbitMQ are running on the same network rabbitMQ has many clients i can ping client from rabbitMQ and back longest latency measured between the machine is 12.1 ms network details : Standard Switch network (network of virtual machines running on single physical machine - using vmware VC) im getting random timeouts when initializing RPC connection /usr/lib/python2.6/site-packages/pika-0.9.5-py2.6.egg/pika/adapters/blocking_connection.py problem is that the timeout isn't consistent and happens from time to time. when manually testing this

Pika blocking_connection.py random timeout connecting to RabbitMQ

这一生的挚爱 提交于 2019-12-01 05:49:26
问题 i have a rabbit mq running on machine both client and rabbitMQ are running on the same network rabbitMQ has many clients i can ping client from rabbitMQ and back longest latency measured between the machine is 12.1 ms network details : Standard Switch network (network of virtual machines running on single physical machine - using vmware VC) im getting random timeouts when initializing RPC connection /usr/lib/python2.6/site-packages/pika-0.9.5-py2.6.egg/pika/adapters/blocking_connection.py

消息队列

青春壹個敷衍的年華 提交于 2019-12-01 05:30:48
一、rabbitmq 1.1 简介 RabbitMQ(Rabbit Message Queue)是流行的开源消息队列系统,用erlang语言开发。 1.1.1 关键词说明 Broker:消息队列服务器实体。 Exchange:消息交换机,它指定消息按什么规则,路由到哪个队列。 Queue:消息队列载体,每个消息都会被投入到一个或多个队列。 Binding:绑定,它的作用就是把exchange和queue按照路由规则绑定起来。 Routing Key:路由关键字,exchange根据这个关键字进行消息投递。 vhost:虚拟主机,一个broker里可以开设多个vhost,用作不同用户的权限分离。 producer:消息生产者,就是投递消息的程序。 consumer:消息消费者,就是接受消息的程序。 channel:消息通道,在客户端的每个连接里,可建立多个channel,每个channel代表一个会话任务。 1.1.2 消息队列运行机制 (1)客户端连接到消息队列服务器,打开一个channel。 (2)客户端声明一个exchange,并设置相关属性。 (3)客户端声明一个queue,并设置相关属性。 (4)客户端使用routing key,在exchange和queue之间建立好绑定关系。 (5)客户端投递消息到exchange。 (6)exchange接收到消息后

pika.exceptions.ProbableAuthenticationError when trying to send message to remote queue

冷暖自知 提交于 2019-12-01 03:42:46
问题 I'm trying to run RabbitMQ Python tutorial but with sender on virtualbox host machine and receiver and queue on virtualbox guest machine. So I modified mentioned send.py code by only replacing localhost with 192.168.1.5 . When I run it, i receive following error: ... File "/home/damian/.virtualenvs/kivy_1.9/local/lib/python2.7/site-packages/pika/adapters/base_connection.py", line 153, in _check_state_on_disconnect raise exceptions.ProbableAuthenticationError pika.exceptions

How to add a header key:value pair when publishing a message with pika

岁酱吖の 提交于 2019-12-01 00:34:45
问题 I am writing an automated test to test a consumer. So far I did not need to include a header when publishing messages but now I do. And it seems like its lacking documentation. This is my publisher: class RMQProducer(object): def __init__(self, host, exchange, routing_key): self.host = host self.exchange = exchange self.routing_key = routing_key def publish_message(self, message): connection = pika.BlockingConnection(pika.ConnectionParameters(self.host)) channel = connection.channel() message

Python操作RabbitMQ

核能气质少年 提交于 2019-11-30 22:12:37
RabbitMQ 1概念 RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统。他遵循Mozilla Public License开源协议。 MQ全称为Message Queue, 消息队列 (MQ)是一种应用程序对应用程序的通信方法。应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接来链接它们。消 息传递指的是程序之间通过在消息中发送数据进行通信,而不是通过直接调用彼此来通信,直接调用通常是用于诸如 远程过程调用 的技术。排队指的是应用程序通过 队列来通信。队列的使用除去了接收和发送应用程序同时执行的要求。 2.RabbitMQ安装 安装配置epel源 $ rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8 .noarch.rpm 安装erlang $ yum - y install erlang 安装RabbitMQ $ yum -y install rabbitmq-server 注意:service rabbitmq-server start/stop 安装API pip install pika or easy_install pika or 源码 https: //pypi.python.org/pypi/pika 使用API操作RabbitMQ

python no module name pika when importing pika

微笑、不失礼 提交于 2019-11-30 18:18:47
问题 I installed pika for python running on a mac sudo pip install pika==0.9.8 I make sure is installed, this is the response when trying to reinstall, Requirement already satisfied (use --upgrade to upgrade): pika==0.9.8 in /usr/local/lib/python2.7/site-packages but when i import pika on a *.py I get, ImportError: No module named pika my python version python --version Python 2.7.5 how to make this module recognised by Python? thanks! edit 1 I call the import like this import pika which gives the

No handlers could be found for logger “pika.adapters.blocking_connection”

橙三吉。 提交于 2019-11-30 17:29:47
Similar questions all seem to be based around using a custom logger, I'm happy to just use the default / none at all. My pika python app runs and receives messages but after a few seconds crashes with No handlers could be found for logger "pika.adapters.blocking_connection" , any ideas? import pika credentials = pika.PlainCredentials('xxx_apphb.com', 'xxx') parameters = pika.ConnectionParameters('bunny.cloudamqp.com', 5672, 'xxx_apphb.com', credentials) connection = pika.BlockingConnection(parameters) channel = connection.channel() channel.queue_declare('messages') def message_received(channel

In Pika or RabbitMQ, How do I check if any consumers are currently consuming?

孤街醉人 提交于 2019-11-30 13:59:49
问题 I would like to check if a Consumer/Worker is present to consume a Message I am about to send. If there isn't any Worker , I would start some workers (both consumers and publishers are on a single machine) and then go about publishing Messages . If there is a function like connection.check_if_has_consumers , I would implement it somewhat like this - import pika import workers # code for publishing to worker queue connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')

SparkStreaming, RabbitMQ and MQTT in python using pika

回眸只為那壹抹淺笑 提交于 2019-11-30 08:29:12
Just to make things tricky, I'd like to consume messages from the rabbitMQ queue. Now I know there is a plugin for MQTT on rabbit ( https://www.rabbitmq.com/mqtt.html ). However I cannot seem to make an example work where Spark consumes a message that has been produced from pika. For example I am using the simple wordcount.py program here ( https://spark.apache.org/docs/1.2.0/streaming-programming-guide.html ) to see if I can I see a message producer in the following way: import sys import pika import json import future import pprofile def sendJson(json): connection = pika.BlockingConnection