I am new to the python . I cant understand channel.start_consuming()
is not working.
my code
def functions(host):
global LOGGER
global RABBITMQ_USER
global RABBITMQ_PASSWORD
while True:
try:
credentials = pika.PlainCredentials(RABBITMQ_USER, RABBITMQ_PASSWORD)
connection = pika.BlockingConnection(pika.ConnectionParameters(
host=host,
credentials=credentials))
print(connection)
channel = connection.channel()
channel.basic_qos(prefetch_size=0, prefetch_count=0, all_channels=True)
channel.basic_consume(basic_handler,
queue='grinshares',
no_ack=False)
channel.basic_consume(basic_handler,
queue='poolshares',
no_ack=False)
print("1")
channel.start_consuming()
print("2")
except Exception as e:
LOGGER.error("Something went wrong: {}\n{}".format(e, traceback.format_exc().splitlines()))
sys.stdout.flush()
time.sleep(10)
Basic-handler definition
def basic_handler(ch, method, properties, body):
global LOGGER
global SHARES
global HEIGHT
print("I am reached here")
/// some code
sys.stdout.flush()
While i run i am getting . I mention some print statements in my code
<BlockingConnection impl=<SelectConnection OPEN socket=('127.0.0.1', 40068)->('127.0.0.1', 5672) params=<ConnectionParameters host=
localhost port=5672 virtual_host=/ ssl=False>>>
1
it did't print 2 - print("2") after the line " channel.start_consuming() " It is not going insde the definition "base_handler" mention in basic_consume.
I am not getting any exceptions