1

i am using pika client for creating connection to rabbitmq for some pub-sub project. A direct call to the client work fine but when i am trying to create a channel inside a celery task i getting an error.

raised unexpected: OSError(9, 'Bad file descriptor')

This is the code for creating connection

connection = pika.BlockingConnection(
pika.ConnectionParameters(
    host=get_secret("RABBIT_MQ_HOST"),
    credentials=pika_credentials.PlainCredentials(
        get_secret("RABBIT_MQ_USERNAME"),
        get_secret("RABBIT_MQ_PASSWORD")
    )
))
channel = connection.channel()

I am getting error at connection.channel().

How can i create connection in celery (broker is also rabbitmq).

Community
  • 1
  • 1
Sanjay Bisht
  • 86
  • 1
  • 7

0 Answers0