Python Forum
pika channel.start_consuming() is not running
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pika channel.start_consuming() is not running
#1
Hi,
I am using python3.5.3 and pika version 0.13.0
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 call basic_handler definition . I am not getting the message "I am reached here" in baic_handler definition

I cannot understand what i did wrong why it is not calling the function basic_handler
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to check if someone send a message in a discord channel? Zerolysimin 1 741 Nov-06-2022, 11:10 AM
Last Post: Larz60+
  Output from Paramiko exec_command from channel pemca 0 2,517 Dec-03-2021, 12:29 PM
Last Post: pemca
  Not able to add multiple channel IDs to python bot flaykez 3 71,295 Oct-18-2021, 01:26 AM
Last Post: CyKlop
  Auto detect threshold for skin detection w/ HSV channel davlovsky 1 2,169 Oct-13-2019, 01:45 AM
Last Post: Larz60+
  How to change TV channel with Python arsenal58 7 6,468 Nov-19-2018, 01:11 AM
Last Post: Larz60+
  AttributeError: type object 'MyClass' has no attribute 'channel' chris0147 2 8,684 Sep-29-2017, 06:16 PM
Last Post: chris0147
  Python and Pika stability issues tremmert 0 39,225 Jun-06-2017, 11:46 AM
Last Post: tremmert
  ORA-03113: end-of-file on communication channel Python Cx_Oracle akansha 3 7,482 Nov-17-2016, 08:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020