Last active
October 4, 2017 22:33
-
-
Save lukebakken/1aefe2716f8bfc3d2ead59a54ad44d95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pika | |
import sys | |
def callback(ch, method, properties, body): | |
pass | |
# print(" [x] Received %r" % body) | |
queue_name = sys.argv[1] | |
cp = pika.ConnectionParameters('shostakovich') | |
connection = pika.BlockingConnection(cp) | |
channel = connection.channel() | |
# channel.basic_qos(prefetch_count=20480) | |
# for method_frame, properties, body in channel.consume(queue_name): | |
# channel.basic_ack(method_frame.delivery_tag) | |
channel.basic_consume(callback, queue=queue_name, no_ack=True) | |
print(' [*] Waiting for messages. To exit press CTRL+C') | |
channel.start_consuming() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pika | |
import sys | |
queue_name = sys.argv[1] | |
cp = pika.ConnectionParameters('shostakovich') | |
connection = pika.BlockingConnection(cp) | |
channel = connection.channel() | |
channel.queue_declare(queue=queue_name) | |
while True: | |
channel.basic_publish(exchange='', routing_key=queue_name, body='Hello!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment