-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathREADME
More file actions
34 lines (26 loc) · 708 Bytes
/
README
File metadata and controls
34 lines (26 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Flopsy
======
A very simple way to interact with python AMQPlib. For my case I'm using
RabbitMQ as my implementation but it should work with others.
settings.py
-----------
AMQP_SERVER = '24.143.38.241'
AMQP_PORT = 5672
AMQP_USER = 'guest'
AMQP_PASSWORD = 'guest'
AMQP_VHOST = '/'
Consumer
--------
>>> import flopsy
>>> consumer = flopsy.Consumer()
>>> def message_callback(message):
... print 'Recieved: ' + message.body
... consumer.channel.basic_ack(message.delivery_tag)
...
>>> consumer.register('message_to_print', message_callback)
>>> consumer.wait()
Publisher
---------
>>> import flopsy
>>> publisher = flopsy.Publisher()
>>> publisher.publish('messages_to_print', 'Test message!')