TCP Spring Integration - Dispatcher has no subscribers for 'response' channel - java

I am using spring integration to make TCP call to server by providing some message and getting response back. I prefer to use channel adapter to send and receive bulk messages. The problem I am facing is with the response channel. Getting "Dispatcher has no subscribers for channel " for response channel.
Everything is working fine except the response not getting transported on response channel. I can see the handshaking at server and the response in the log being put on the response and logger channels. But after that exception is thrown. Configuration setup is:
<gateway id="clientPositionsGateway" service-interface="MyGatewayInterface">
<method name="fetchClientPositions" request-channel="clientPositionsRequestChannel" />
</gateway>
<channel id="clientPositionsRequestChannel" />
<splitter input-channel="clientPositionsRequestChannel"
output-channel="singleClientPositionsRequestChannel" />
<channel id = "singleClientPositionsRequestChannel" />
<transformer
input-channel="singleClientPositionsRequestChannel"
output-channel="dmQueryRequestChannel"
ref="dmPosBaseQueryTransformer" />
<channel id = "dmQueryRequestChannel">
<!-- <dispatcher task-executor="executor"/> -->
</channel>
<ip:tcp-connection-factory id="csClient"
type="client"
host="somehost"
port="12345"
single-use="true"
deserializer="connectionSerializeDeserialize"
/>
<ip:tcp-outbound-channel-adapter id="dmServerOutboundAdapter"
channel="dmQueryRequestChannel"
connection-factory="csClient"
order="2"
/>
<ip:tcp-inbound-channel-adapter id="dmServerInboundAdapter"
channel="dmQueryResponseChannel"
connection-factory="csClient"
error-channel="errorChannel"/>
<channel id="dmQueryResponseChannel"/>

As Artem said in his comment, 'Dispatcher has no subscribers' means here that there is no endpoint configured to receive the response on dmQueryResponseChannel, or the endpoint configured with that channel as its input channel is not started.
In any case, even when you resolve that, using independent adapters for request/response scenarios is tricky because the framework has no way to automatically correlated the response to the request. That's what the outbound gateway is for. You can use collaborating adapters, but you have to deal with the correlation yourself. If you are using a request/reply gateway to initiate the flow, you will have to use a technique such as the one explored in the tcp-client-server-multiplex sample. This is because using independent adapters means you'll lose the replyChannel header used to get the response back to the gateway.
Or, you can use a void returning gateway to send the request, and an <int:outbound-channel-adapter/> so the framework will call back with the response and you can do your own correlation programmatically.

If your clientPositionsGateway is invoked from client threads, there is no reason to use executor channels. If you do million loop clientPositionsGateway try to use Future gateway: http://docs.spring.io/spring-integration/docs/2.2.5.RELEASE/reference/html/messaging-endpoints-chapter.html#async-gateway and again: without executor channels. And I don't see reason to use reply-channel on both gateways.
And one more: you have <splitter> before <tcp:outbound-gateway>, but where is an <aggregator> after <tcp:outbound-gateway>?..
In your current case you get reply from your clientPositionsGateway, all others will be dropped, because TemporaryReplyChannel will be already closed.

public interface ClientPositionsGateway {
String fetchClientPositions(List<String> clientList);
}

Here is a code that solved my Problem :
#ContextConfiguration(locations={"/clientGIM2Position.xml"})
#RunWith(SpringJUnit4ClassRunner.class)
public class GetClientPositionsTest {
#Autowired
ClientPositionsGateway clientPositionsGateway;
#Test
public void testGetPositions() throws Exception {
String positions = clientPositionsGateway.fetchClientPositions(clientList);
System.out.println("returned !!!!" + positions);
}
}

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/integration"
xmlns:ip="http://www.springframework.org/schema/integration/ip"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
<!-- intercept and log every message -->
<logging-channel-adapter id="logger" level="DEBUG" />
<wire-tap channel = "logger" />
<gateway id="clientPositionsGateway"
service-interface="com.example.ClientPositionsGateway">
<method name="fetchClientPositions" request-channel="clientPositionsRequestChannel" reply-channel="dmQueryResponseChannel"/>
</gateway>
<channel id="clientPositionsRequestChannel" />
<splitter input-channel="clientPositionsRequestChannel"
output-channel="singleClientPositionsRequestChannel" />
<channel id = "singleClientPositionsRequestChannel" />
<transformer
input-channel="singleClientPositionsRequestChannel"
output-channel="dmQueryRequestChannel"
ref="dmPosBaseTransQueryTransformer" />
<channel id = "dmQueryRequestChannel">
<dispatcher task-executor="executor"/>
</channel>
<ip:tcp-connection-factory id="csClient"
type="client"
host="hostserver"
port="22010"
single-use="true"
deserializer="connectionSerializeDeserialize"
/>
<ip:tcp-outbound-gateway id="dmServerGateway"
request-channel="dmQueryRequestChannel"
reply-channel="dmQueryResponseChannel"
connection-factory="csClient" />
<channel id="dmQueryResponseChannel">
<dispatcher task-executor="executor"/>
</channel>
<channel id="serverBytes2StringChannel" />
<bean id="connectionSerializeDeserialize" class="com.example.DMQueryResponseSerializer"/>
<bean id="dmPosBaseTransQueryTransformer" class="com.example.DMPOSBaseTransQueryTransformer"/>
<task:executor id="executor" pool-size="5"/>
</beans:beans>

Configuration settings:
<gateway id="clientPositionsGateway" service-interface="com.example.ClientPositionsGateway">
<method name="fetchClientPositions" request-channel="clientPositionsRequestChannel" reply-channel="dmQueryResponseChannel"/>
</gateway>
<channel id="clientPositionsRequestChannel" />
<splitter input-channel="clientPositionsRequestChannel"
output-channel="singleClientPositionsRequestChannel" />
<channel id = "singleClientPositionsRequestChannel" />
<transformer
input-channel="singleClientPositionsRequestChannel"
output-channel="dmQueryRequestChannel"
ref="dmPosBaseQueryTransformer" />
<logging-channel-adapter channel="clientBytes2StringChannel"/>
<channel id = "dmQueryRequestChannel">
<dispatcher task-executor="executor"/>
</channel>
<ip:tcp-connection-factory id="csClient"
type="client"
host="serverHost"
port="22010"
single-use="true"
deserializer="connectionSerializeDeserialize"
/>
<ip:tcp-outbound-channel-adapter id="dmServerOutboundAdapter"
channel="dmQueryRequestChannel"
connection-factory="csClient"
/>
<ip:tcp-inbound-channel-adapter id="dmServerInboundAdapter"
channel="dmQueryResponseChannel"
connection-factory="csClient"
error-channel="errorChannel"/>
<transformer input-channel="dmQueryResponseChannel" output-channel="clientBytes2StringChannel" ref="dmPOSBaseQueryResponseTransformer"
/>
<channel id="dmQueryResponseChannel"/>
<channel id="clientBytes2StringChannel"/>

Related

Spring integration with multiple executor channel not processing in parallel

I have requirement where i need to pass message to multiple channels asyc. To make my flow asyc i am using all executor channel. But for some reason flow is still sequential. i can seen diff thread as i configured in task executor but in sequence.
Here is the configuration I am using
<int:channel id="mainChannel">
<int:interceptors>
<int:wire-tap channel="channel1"/>
<int:wire-tap channel="channel2"/>
<int:wire-tap channel="channel3"/>
</int:interceptors>
</int:channel>
<int:channel id="channel1">
<int:dispatcher task-executor="exec1" />
</int:channel>
<int:channel id="channel2">
<int:dispatcher task-executor="exec2" />
</int:channel>
<int:channel id="channel3">
<int:dispatcher task-executor="exec3" />
</int:channel>
As per my understanding all this will be asyc (in my case 3 thread should run in parallel)
from log i can see all sequential but with diff thread name..
I am assuming preSend/Postsend should have been called in random order.
am i missing anything to make multiple executor channel in parallel.
I will really appreciate any help.
You might need to call the async implementation bean as shown:
<beans:bean id="asyncExecutor"
class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<int:channel id="channel1">
<int:dispatcher task-executor="asyncExecutor" />
</int:channel>
<int:channel id="channel2">
<int:dispatcher task-executor="asyncExecutor" />
</int:channel>
<int:channel id="channel3">
<int:dispatcher task-executor="asyncExecutor" />
</int:channel>
Description of SimpleAsyncTaskExecutor:
public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
implements AsyncListenableTaskExecutor, Serializable
TaskExecutor implementation that fires up a new Thread for each task,
executing it asynchronously.
Supports limiting concurrent threads through the "concurrencyLimit"
bean property. By default, the number of concurrent threads is
unlimited.
NOTE: This implementation does not reuse threads! Consider a
thread-pooling TaskExecutor implementation instead, in particular for
executing a large number of short-lived tasks.
Example Of Usage from Github:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
<channel id="taskExecutorOnly">
<dispatcher task-executor="taskExecutor"/>
</channel>
<channel id="failoverFalse">
<dispatcher failover="false"/>
</channel>
<channel id="failoverTrue">
<dispatcher failover="true"/>
</channel>
<channel id="loadBalancerDisabled">
<dispatcher load-balancer="none"/>
</channel>
<channel id="loadBalancerDisabledAndTaskExecutor">
<dispatcher load-balancer="none" task-executor="taskExecutor"/>
</channel>
<channel id="roundRobinLoadBalancerAndTaskExecutor">
<dispatcher load-balancer="round-robin" task-executor="taskExecutor"/>
</channel>
<channel id="lbRefChannel">
<dispatcher load-balancer-ref="lb"/>
</channel>
<beans:bean id="taskExecutor"
class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<beans:bean id="lb"
class="org.springframework.integration.channel.config.DispatchingChannelParserTests.SampleLoadBalancingStrategy"/>
</beans:beans>
from log i can see all sequential but with diff thread name
Because logs are just a single place where messages are printed and they really are printed by one writer even if from different thread. They are appear over there one by one. With a good load you would definitely see that messages are logged in an unexpected order.
I am assuming preSend/Postsend should have been called in random order.
That's not true. Interceptors are called in an order how they are added to the channel and if their order is the same, which is a case for you. It is already not an interceptor chain responsibility how those interceptors are implemented.
I think you just were not lucky to see logs in arbitrary order and probably just because consumers for those executor channels are plain loggers - no any loads to hold the thread and have an impression that work in other threads is done in parallel.

Spring Integration : Dispatcher has no subscribers for channel

I am trying to build a spring integration application, which has the following configuration (the culprit seems to be the channel xsltSpecific) :
<beans:beans>
<channel id="channel1"></channel>
<channel id="channel2"></channel>
<channel id="xsltSpecific"></channel>
<channel id="xsltSpecificDelayed"></channel>
<channel id="xsltCommon"></channel>
<channel id="irdSpecificUnmarshallerChannel"></channel>
<channel id="irdSpecificInputChannel"></channel>
<file:outbound-channel-adapter
directory="${dml.ird.directory}" channel="channel1"
auto-create-directory="true" filename-generator="timestampedFileNameGenerator">
</file:outbound-channel-adapter>
<recipient-list-router input-channel="fileChannel">
<recipient channel="channel1" selector-expression="${dml.data.logs.enable}" />
<recipient channel="channel2" />
</recipient-list-router>
<recipient-list-router input-channel="channel2">
<recipient channel="xsltSpecificDelayed"></recipient>
<recipient channel="xsltCommon"></recipient>
</recipient-list-router>
<delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>
<jms:message-driven-channel-adapter
id="jmsInboundAdapterIrd" destination="jmsInputQueue" channel="fileChannel"
acknowledge="transacted" transaction-manager="transactionManager"
error-channel="errorChannel" client-id="${ibm.jms.connection.factory.client.id}"
subscription-durable="true" durable-subscription-name="${ibm.jms.subscription.id1}" />
<si-xml:xslt-transformer input-channel="xsltCommon" output-channel="jmsInputChannel"
xsl-resource="classpath:summit-hub-to-cpm-mapping.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
<si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
<si-xml:unmarshalling-transformer id="irdUnmarshaller"
unmarshaller="irdUnmarshallerDelegate" input-channel="irdSpecificUnmarshallerChannel"
output-channel="saveSpecificTradeChannel" />
<beans:bean id="irdUnmarshallerDelegate"
class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<beans:property name="schema"
value="summit-hub-specific.xsd" />
<beans:property name="contextPath"
value="com.h.i.c.d.i.mapping" />
</beans:bean>
<beans:bean id="resultTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />
<service-activator ref="specificTradeService" input-channel="saveSpecificTradeChannel"
requires-reply="false" method="save"/>
<file:inbound-channel-adapter directory="${dml.retry.directoryForIrd}"
channel="fileChannelAfterRetry" auto-create-directory="true"
prevent-duplicates="false" filename-regex=".*\.(msg|xml)" queue-size="50" >
<poller fixed-delay="${dml.retry.delay}" max-messages-per-poll="50">
<transactional transaction-manager="transactionManager" />
</poller>
</file:inbound-channel-adapter>
<channel id="fileChannel"/>
<channel id="fileChannelAfterRetry"/>
<file:file-to-string-transformer
input-channel="fileChannelAfterRetry" output-channel="fileChannel"
delete-files="true" />
<beans:import resource="classpath:cpm-dml-common-main.xml" />
</beans:beans>
But I am having the following exception :
org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.GenericApplicationContext#6950e31.xsltSpecific'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
What does this exception mean ?
Also, I am not able to spot the problem, can you help me fix this issue ?
UPDATE
Sorry, I didn't give the whole context earlier, because I didn't think it was relevant.
The exception arises during a test derived from AbstractTransactionalJUnit4SpringContextTests, which closed the application context at the end of the test, before the message had a chance to get to the end.
I've added a Thread.sleep(10000) at the end of the test, and the exception doesn't happen anymore.
The xsltSpecific is just a default DirectChannel with a UnicastingDispatcher to deliver messages to channel's subscribers.
According your configuration you send a message to this channel from the:
<delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>
And also it looks like you really have a subscriber to this channel:
<si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>
What is really not clear when this defined subscriber is lost. It doesn't look like you have an auto-startup="false" on this endpoint, but on the other hand maybe you really stop it at runtime...
Would you mind to share more stack trace on the matter? I want to see who is an original caller for that lost message.

Mix tcp-connection-factory + tcp-inbound-gateway + router

Can I send distinct messages (distinct serialize/deserialize) to the same tcp server (same host and port) and differentiate the tcp-inbound-gateway by some value of header or payload with a router???
(...)
I want to add a router for select the correct tcp-inbound-gateway depends on some field in header or payload (for example named typedata). In what order would enter the request (or message) between router, tcp-inbound-gateway, tcp-connection-factory, serialize/deserialize? Will I have problems with the serialization/deserialization for chose the tcp-inbound-gateway? What is the correct way to do this?
Thanks in advance.
EDIT
In server:
<!-- Common -->
<int:channel id="channelConnectionFactoryRequest" />
<int:channel id="channelConnectionFactoryResponse" />
<router method="getDestinationChannel"
input-channel="channelSConnectionFactoryRequest">
<beans:bean class="org.mbracero.integration.CustomRouter" />
</router>
<beans:bean id="customSerializerDeserializer"
class="org.mbracero.integration.serialization.CustomSerializerDeserializer" />
<int-ip:tcp-connection-factory id="customConnectionFactory"
type="server" port="${payment.port}" single-use="true"
serializer="customSerializerDeserializer"
deserializer="customSerializerDeserializer" />
<int-ip:tcp-inbound-gateway id="customInboundGateway"
connection-factory="customConnectionFactory"
request-channel="channelCustomConnectionFactoryRequest"
reply-channel="channelCustomConnectionFactoryResponse"
error-channel="errorChannel" />
<!-- Custom -->
<beans:bean id="operations"
class="org.mbracero.integration.applepay.impl.OperationsImpl" />
<!-- Operation One -->
<int:channel id="operationOneRequest" />
<int:service-activator input-channel="operationOneRequest"
output-channel="operationOneResponse" ref="operations" method="getOperationOne" />
<!-- Operation Two -->
<int:channel id="operationTwoRequest" />
<int:service-activator input-channel="operationTwoRequest"
output-channel="operationTwoResponse" ref="operations" method="getOperationTwo" />
OperationsImpl:
ResultOne getOperationOne(RequestOne request);
ResultTwo getOperationOne(RequestTwo request);
ResultOne & ResultTwo implements ResultBase. And in serialize of customSerializerDeserializer I have:
#Override
public void serialize(ResultBase arg0, OutputStream arg1) throws IOException {
byte[] xxx = XXX.getBytes();
arg1.write(xxx);
byte[] yyy = yyy.getBytes();
arg1.write(senderName);
// **Each custom object have a method for serialize their own data**
arg0.transformDataToByte(arg1);
arg1.flush();
}
In client:
<gateway id="tmGateway"
service-interface="org.mbracero.integration.CustomGateway" />
<beans:bean id="operationOneSerializerDeserializer"
class="org.mbracero.integration.serialization.OperationOneSerializerDeserializer" />
<int-ip:tcp-connection-factory id="operationOneFactory"
type="client" host="127.0.0.1" port="7878" single-use="true"
serializer="operationOneSerializerDeserializer" deserializer="operationOneSerializerDeserializer" />
<int-ip:tcp-outbound-gateway id="operationOneOutGateway"
request-channel="operationOneChannel" connection-factory="operationOneFactory"
request-timeout="5000" reply-timeout="5000" remote-timeout="5000" />
<beans:bean id="operationTwoSerializerDeserializer"
class="org.mbracero.integration.operationTwoRequestSerializerDeserializer"/>
<int-ip:tcp-connection-factory id="operationTwoFactory"
type="client" host="127.0.0.1" port="7878" single-use="true"
serializer="operationTwoSerializerDeserializer"
deserializer="operationTwoSerializerDeserializer" />
<int-ip:tcp-outbound-gateway id="operationTwoOutGateway"
request-channel="operationTwoChannel" connection-factory="operationTwoFactory"
request-timeout="50000" reply-timeout="50000" remote-timeout="50000" />
CustomGateway:
#Gateway(requestChannel="operationOneChannel")
OperationOneResponse sendOperationOne(OperationOneRequest request);
#Gateway(requestChannel="operationTwoChannel")
OperationTwoResponse sendOperationTwo(OperationTwo request);
You cannot have 2 server connection factories listening on the same port. TCP doesn't allow it - the network stack wouldn't know which server socket to route the request to.
There's no problem on the client side but, with a single socket, the server would have to understand how to deserialize both data types.
It's probably easier to combine the serializers/deserializers into one on both sides (add another header to the message so the deserializer knows what type of payload to decode).

Mule ESB + TOMCAT Web Application Integration

I have a Spring MVC Web application that performs CRUD operations on Tomcat Server. Can I use Mule ESB as a request handler before Tomcat. For example, users request to localhost:8181/user/create (Mule ESB Port) and Mule redirect request to localhost:8080/user/create (Tomcat Server Port) and sends response back over mule. I am using Mule ESB for webservices, but I don't understand how can I use Mule ESB for web application requests.
You can use the new HTTP module released in 3.6 and create a proxy using this flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="proxyConfig" host="localhost" port="${proxyPort}" />
<http:request-config name="requestConfig" host="localhost" port="${httpPort}" />
<flow name="proxyTemplate">
<http:listener config-ref="proxyConfig" path="/*" responseStreamingMode="AUTO" parseRequest="false" >
<http:response-builder statusCode="#[message.inboundProperties['http.status']]" reasonPhrase="#[message.inboundProperties['http.reason']]" />
</http:listener>
<copy-properties propertyName="*" />
<remove-property propertyName="http.*" />
<copy-attachments attachmentName="*" />
<set-property propertyName="X-Forwarded-For" value="#[message.inboundProperties['http.remote.address']]" />
<http:request config-ref="requestConfig" method="#[message.inboundProperties['http.method']]" path="#[message.inboundProperties['http.request.path']]" parseResponse="false" >
<http:request-builder>
<http:query-params expression="#[message.inboundProperties['http.query.params']]" />
</http:request-builder>
</http:request>
<copy-properties propertyName="*" />
<remove-property propertyName="http.*" />
<copy-attachments attachmentName="*" />
</flow>
</mule>

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>
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.

Categories