Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

422
Views
Unable to exchange message in RabbitMQ-FASTApi application. Getting Error: Unprocessable Entity error

I am trying to build a very simple RabbitMQ-FastAPI based application that would be able to run on Kubernetes. Created two separate APIs for producer and consumer. Producer API:

@app.get("/hello/{message}")
def post_message(message: str = Body(..., example="Hello World!")):
try:
    connection = pika.BlockingConnection(
    pika.ConnectionParameters(host="rabbitmq-0.rabbitmq-headless.keda.svc.cluster.local", port=5672, 
    credentials=pika.PlainCredentials("user", "PASSWORD")))
        
    channel = connection.channel()
    #channel.exchange_declare(exchange='logs', exchange_type='direct')

    #severity = ['hello', 'message', 'error']
    #messages = ['Hafizur', 'message', 'error']

    channel.queue_declare(queue='hello')

    channel.basic_publish(exchange='', routing_key='hello', body=message)

    connection.close()

    return {"Successfully sended {} do queue".format(message)}  

Consumer API:

@app.post("/message")
def get_message():
try:
    connection = pika.BlockingConnection(
    pika.ConnectionParameters(host="rabbitmq-0.rabbitmq-headless.keda.svc.cluster.local", port=5672, 
    credentials=pika.PlainCredentials("user", "PASSWORD")))
    channel = connection.channel()
    channel.queue_declare(queue='hello')
    
    channel.basic_consume(on_message_callback=callback, queue="hello", auto_ack=True)
    print(" [*] Waiting for messages. To exit press CTRL+C")
    channel.start_consuming()
    
except Exception as e:
    raise HTTPException(status_code=500, detail=str(e))

From here I am building two docker images, one for the producer and another for the consumer. Using those built two deployments on K8S. Did port forwarding and accessed to the producer API and tried to send some message to RabbitMQ queue. But getting Error: Unprocessable Entity.

I am seeking your help to solve this issue.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!