Search code examples
javarabbitmqmuleamqp

How to disable tempQueues in Async AMQP-RabbitMQ Implementation in Mule?


How am i supposed to disable the amqp-gen queues that creates automatically? in Mule ActiveMQ i got a "disableTemporaryReplyToDestinations" property, by setting that to 'true' and doing a one-way exchange-pattern, i'm able to implement async messaging.

Now with AMQP/RabbitMQ it's a different story, i do have the one-way exchange pattern but i dont have any property to set from the component side inside MuleStudio that tells me to disable those, i can't even disable it from the RabbitMQ Panel.

How do i disable those tempQueues (called amqp-gen in AMQP) which are not needed for an async implementation?

This is my test XML

<mule xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/amqp http://www.mulesoft.org/schema/mule/amqp/current/mule-amqp.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">

 <amqp:connector name="AMQP_Connector" validateConnections="true" 
                    host="arbuzqorks" 
                    port="1111" 
                    fallbackAddresses="localhost:5672" 
                    doc:name="AMQP Connector"/>

    <flow name="rabbitmq_demoFlow1" doc:name="rabbitmq_demoFlow1">
        <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="rabbitmq" doc:name="HTTP"/>
        <set-payload value="#['This is a test message that...']" doc:name="Setting payload"/>
        <amqp:outbound-endpoint  exchangeType="direct" responseTimeout="10000" doc:name="AMQP" connector-ref="AMQP_Connector" exchangeName="async-direct-test" exchangeDurable="true" queueDurable="true"/>
    </flow>
    <flow name="async-rabbitmqFlow1" doc:name="async-rabbitmqFlow1">
        <amqp:inbound-endpoint exchange-pattern="one-way" exchangeName="async-direct-test" exchangeDurable="true" queueDurable="true" responseTimeout="10000" connector-ref="AMQP_Connector" doc:name="AMQP"/>
        <byte-array-to-string-transformer doc:name="Byte Array to String"/>
        <set-payload value="#[payload + ' passed into the consumer flow']" doc:name="adding string to payload"/>
        <amqp:outbound-endpoint exchange-pattern="one-way" routingKey="test_response" exchangeType="direct" exchangeDurable="true" queueDurable="true" responseTimeout="10000" connector-ref="AMQP_Connector" doc:name="AMQP" exchangeName="async-direct-test"/>
    </flow>
    <flow name="async-rabbitmqFlow2" doc:name="async-rabbitmqFlow2">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="asyncamqp" doc:name="HTTP"/>
        <component class="com.web.esb.component.AsyncMessageRequestorComponent" doc:name="Request AMQP Message"/>
    </flow>
</mule>

Solution

  • Your "issue" is not related to temporary queues and trying to disable them but in fact is a feature called "private queues" (see the doc for more information).

    Basically, because you do not name the queues you declare in your AMQP inbound and outbound endpoints, RabbitMQ consider them as private to your connection and give them generated names.

    Use the queueName attribute to configure queue names on your AMQP endpoints and things will work as you intend.