如何在Mule中的异步AMQP-RabbitMQ实现中禁用tempQueues?

时间:2013-09-16 18:22:53

标签: java rabbitmq mule amqp

我应该如何禁用自动创建的amqp-gen队列?在Mule ActiveMQ中我有一个“disableTemporaryReplyToDestinations”属性,通过将其设置为“true”并执行单向交换模式,我能够实现异步消息传递。

现在使用AMQP / RabbitMQ这是一个不同的故事,我确实有单向交换模式,但我没有任何属性设置从MuleStudio内部的组件方面告诉我禁用它们,我甚至无法禁用它来自RabbitMQ Panel。

如何禁用异步实现不需要的那些tempQueue(在AMQP中称为amqp-gen)?

这是我的测试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>

1 个答案:

答案 0 :(得分:1)

您的“问题”与临时队列无关并尝试禁用它们,但实际上是一个名为“私人队列”的功能(see the doc for more information)。

基本上,因为您没有为在AMQP入站和出站端点中声明的队列命名,所以RabbitMQ将它们视为您的连接的私有,并为它们生成名称。

使用queueName属性在AMQP端点上配置队列名称,事情将按预期运行。