Nav

How To Avoid Changing the AMQP Topography

You can set the createFallbackExchange and createFallbackQueue global config properties so that the declaration of AMQP exchanges and queues is disabled. These parameters have been added for those scenarios where it must be guaranteed that no changes to the AMQP topography will be attempted. In those cases, both the declaration of queues and exchanges which do not previously exist will result in an AMQP:CREATION_NOT_ALLOWED error.

Take for example the following flow:


       
    
1
2
3
4
5
6
7
8
9
10
11
<amqp:config name="Amqp_Config" createFallbackExchange="false" >
        <amqp:connection host="localhost" username="guest" password="guest" />
</amqp:config>


<flow name="mule-no-create-fallback-queue">
        <http:listener doc:name="Listener"config-ref="HTTP_Listener_config" path="/"/>
        <amqp:publish doc:name="Publish" config-ref="Amqp_Config" exchangeName="newExchange">
                <amqp:fallback-exchange-definition />
        </amqp:publish>
</flow>

If the newExchange exchange does not exist and the createFallbackExchange is set to false, an invocation of the publish operation shall derive in a AMQP:CREATION_NOT_ALLOWED error. Notice that the createFallbackExchange can be overridden at the operation level and it can get an expression as a value. For example:

<flow name="mule-no-create-fallback-queue">
	<http:listener doc:name="Listener"config-ref="HTTP_Listener_config" path="/"/>
	<amqp:publish doc:name="Publish" config-ref="Amqp_Config" exchangeName="newExchange" createFallbackExchange="false">
		<amqp:fallback-exchange-definition />
	</amqp:publish>
</flow>

The use of createFallbackQueue parameter in a consume operation is analogous:


       
    
1
2
3
4
5
6
7
8
9
10
11
<amqp:config name="Amqp_Config" createFallbackQueue="false" >
        <amqp:connection host="localhost" username="guest" password="guest" />
</amqp:config>


<flow name="mule-no-create-fallback-queue">
        <http:listener doc:name="Listener"config-ref="HTTP_Listener_config" path="/"/>
        <amqp:consume config-ref="Amqp_Config" queueName="testQueue">
                <amqp:fallback-queue-definition removalStrategy="SHUTDOWN" exchangeToBind="exchangeToBindToQueue" />
        </amqp:consume>
</flow>

You can also use this parameter in the listener:


       
    
1
2
3
4
5
6
7
8
9
10
11
12
13
<amqp:config name="Amqp_Config" createFallbackQueue="false" >
        <amqp:connection host="localhost" username="guest" password="guest" />
</amqp:config>


<flow name="mule-no-create-fallback-queue">
        <amqp:listener config-ref="Amqp_Config" queueName="testQueue">
                <amqp:fallback-queue-definition removalStrategy="SHUTDOWN" exchangeToBind="exchangeToBindToQueue" />
        </amqp:listener>
        <amqp:consume config-ref="Amqp_Config" queueName="testQueue">
                <amqp:fallback-queue-definition removalStrategy="SHUTDOWN" exchangeToBind="exchangeToBindToQueue" />
        </amqp:consume>
</flow>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+