Jun 29, 2011

RabbitMQ, pika

You Might Need Messaging If…

FAQ

Rabbitmq 访问控制
virtual host:
首次开启或者使用新数据库时,rabbitmq 会自动创建
1. a virtual host named /
2. a user named guest with a default password of guest, granted full access to the / virtual host.
推荐删除 guest 帐号,或者修改帐号密码。

Access control

When an AMQP client establishes a connection to an AMQP server, it specifies a virtual host within which it intends to operate. A first level of access control is enforced at this point, with the server checking whether the user has any permissions to access the virtual hosts, and rejecting the connection attempt otherwise.

Resources, i.e. exchanges and queues, are named entities inside a particular virtual host; the same name denotes a different resource in each virtual host. A second level of access control is enforced when certain operations are performed on resources.

RabbitMQ Server Installation
按照上面说的做

可以使用默认配置(端口为5672),无需任何额外工作。
或者你可以改动配置

要长期使用就选择作为一个daemon,短时间用用练练手就作为一个应用

启动应用
rabbitmq-server -detached
查询状况
rabbitmqctl status
结束
rabbitmqctl stop

pika

pika 是一个python库,支持AMQP(Advanced_Message_Queuing_Protocol)协议,用于和RabbitMQ交互。

删除 rabbitmq 的queue

RabbitMQ tutorial 有 pika 和 java 两种客户端(rabbitmq 是一个服务)
Another tutorial: RabbitMQ with python and ruby RuPy 2009

基本元素
producer
consumer
exchange
queue

0 comments: