Hi,
I am using the below code for the receiving messages from the rabbitmq server...
The program was working fine but in the consuming part i don't need to consume continuously instead i required a to consume a message by message.
Kindly guide what type of code that should be modified for this....
Thanks and Regards,
Robert.J
I am using the below code for the receiving messages from the rabbitmq server...
The program was working fine but in the consuming part i don't need to consume continuously instead i required a to consume a message by message.
Code:
import pika import os import time connection = pika.BlockingConnection(pika.ConnectionParameters( host='localhost')) channel = connection.channel() channel.exchange_declare(exchange='acknowledgment',type="direct",durable=True,auto_delete=False) channel.queue_declare(queue="ACK",durable=True) channel.queue_bind(queue='ACK',exchange='acknowledgment',routing_key='acknowledgment') def callback(ch, method, properties, body): srt="%r" % (body) print "Received" channel.basic_consume(callback,queue='ACK',no_ack=True,consumer_tag='acknowledgment') [I]channel.start_consuming()[/I]
Thanks and Regards,
Robert.J