Search code examples
javarabbitmqmuleamqp

How to use the muleClient.request for Async AMQP-RabbitMQ Implementation from Java?


In order to get a message from an exchange/queue, how am i supposed to do it java side by using the MuleClient.request() ?

Tried doing client.request("amqp://exchangeName?connector=AMQP_Connector", 15000) but didn't seem to work.

Or might be something like "client.request("amqp://localhost:5672?exchangeName=name&connector=AMQP_Connector", 15000) ???

And another question comes up, what if i wanna get the message from certain exchange and certain queue? i need to also set the queueName, right? or some kind of routingKey that leads me to the specific queue?

In the AMQP Documentation for Mule says this:

The endpointUri of an AMQP Inbound-Endpoint is conformed as: amqp://{exchange-name}/amqp-queue.{queue-name}. So, using two different endpoints pointing to the same exchange and queue will result in a duplicate endpointUri.

But what's the "amqp-queue"? I'm trying now amqp://exchange-name/queue-name but doesn't work -obviously- since its missing that amqp-queue which i don't know what it is. The documentation doesn't says too much :S

Help me with that please.

Thanks.


Solution

  • "amqp-queue" is a string that you should leave as is, so the following pattern:

    amqp://{exchange-name}/amqp-queue.{queue-name}
    

    would be resolved to:

    amqp://myExchange/amqp-queue.myQueue
    

    for an exchange named myExchange and a queue named myQueue.