Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7009

RabbitMQ Consumer does not pick up REPLY_TO

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.12.1
    • Fix Version/s: 2.12.2
    • Component/s: camel-rabbitmq
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When using RPC in RabbitMQ, the producer sets up an exclusive queue and specifies that queue as the reply_to on outgoing messages. When the consumer in camel-rabbitmq receives the messages, the reply_to isn't available on the exchange, so no RPC calls can be completed.

      The following Python script (from RabbitMQ In Action) produces the message with a reply_to property:

      import time, json, pika

      creds_broker = pika.PlainCredentials("guest", "guest")
      conn_params = pika.ConnectionParameters("localhost",
      virtual_host = "/",
      credentials = creds_broker)
      conn_broker = pika.BlockingConnection(conn_params)
      channel = conn_broker.channel()

      msg = json.dumps(

      {"client_name": "RPC Client 1.0", "time" : time.time()}

      )
      result = channel.queue_declare(exclusive=True, auto_delete=True)
      msg_props = pika.BasicProperties()
      msg_props.reply_to = result.method.queue

      channel.basic_publish(body=msg,
      exchange="talentsprout.rpc",
      properties=msg_props,
      routing_key="ping")

      print "Sent 'Ping' RPC call. Waiting for reply..."

      def reply_callback(channel, method, header, body):
      """Receives RPC server replies."""
      print "RPC Reply — " + body
      channel.stop_consuming()

      channel.basic_consume(reply_callback,
      queue=result.method.queue,
      consumer_tag=result.method.queue)

      channel.start_consuming()

      The following route in Camel would consume messages from this queue:

      from("rabbitmq://192.168.213.130/talentsprout.rpc?queue=ping&routingKey=ping&durable=False&autoDelete=False&autoAck=False&username=guest&password=guest")
      .log("Headers: ${headers}");

      The log statement from that route shows that no reply_to header is added.

      Without this feature, RPC from external producers cannot work.

        Attachments

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              jrfoster67 Jason Foster
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: