Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

424
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda