New to FUSE and Camel.
Downloaded CBR project from (https://github.com/jboss-fuse/quickstarts) and was able to run it as standalone camel project.
cbr.xml is as follows. This drops MSG from a work/cbr/input directory into another. Could run this as mvn camel:run
<route id="cbr-route">
<from uri="file:work/cbr/input" />
<log message="Receiving order ${file:name}" />
<choice>
<when>
<xpath>/order:order/order:customer/order:country = 'UK'</xpath>
<log message="Sending order ${file:name} to the UK" />
<to uri="file:work/cbr/output/uk" />
</when>
<when>
<xpath>/order:order/order:customer/order:country = 'US'</xpath>
<log message="Sending order ${file:name} to the US" />
<to uri="file:work/cbr/output/us" />
</when>
<otherwise>
<log message="Sending order ${file:name} to another country" />
<to uri="file:work/cbr/output/others" />
</otherwise>
</choice>
<log message="Done processing ${file:name}" />
</route>
</camelContext>
But ReadMe says start FUSE SEVER
trying to understand why do i need FUSE container at all if i am able to run it as standlone
There is a project requirement that web service calls from Client go through FUSE for making it asynchronous.
assuming i would not need fuse container in this case
Thanks for taking the time and reading
The FUSE is the container just like any other container , say tomcat, where you deploy your code to.
If you have a lot of integration scenarios and then you need to have a dedicated server to hold and run all your deploy-able. At least that is what I would suggest.
But if there are only a few of such scenarios you can use the power of camel , being framework,use it as a supporting jar for your java code and run as a standalone code.
This means you are responsible to number of requests and issues regarding availability or scalability for that piece of integration code.
Related
I have 2 separate Amazon SQS queues; Queue and ResponseQueue.
SQS configurations:
<sqs:config name="Amazon_SQS_Consumer" accessKey="XXX" secretKey="XXX" queueName="Queue" doc:name="Amazon SQS">
<sqs:connection-pooling-profile maxActive="10" maxIdle="10" exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="12000" minEvictionMillis="60000" evictionCheckIntervalMillis="30000" initialisationPolicy="INITIALISE_ONE"/>
<reconnect count="5" frequency="1000"/>
</sqs:config>
<sqs:config name="Amazon_SQS_Response" accessKey="XXX" secretKey="XXX" queueName="ResponseQueue" doc:name="Amazon SQS">
<sqs:connection-pooling-profile maxActive="100" maxIdle="10" exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="12000" minEvictionMillis="60000" evictionCheckIntervalMillis="30000" initialisationPolicy="INITIALISE_ONE"/>
<reconnect count="5" frequency="1000"/>
</sqs:config>
I have no problem receiving messages from the first queue (Queue) via:
<flow name="consumer" doc:name="consumer">
<sqs:receive-messages config-ref="Amazon_SQS_Consumer" preserveMessages="true" doc:name="Amazon SQS (Streaming)" visibilityTimeout="300" />
<logger level="INFO" message="#[payload]" />
</flow>
I need to also receive messages from the second queue (ResponseQueue):
<flow name="response" doc:name="response">
<sqs:receive-messages config-ref="Amazon_SQS_Response" preserveMessages="true" doc:name="Amazon SQS (Streaming)" visibilityTimeout="300" />
<logger level="INFO" message="#[payload]" />
</flow>
However, whenever the second sqs:receive-messages is added, I get the following error:
Exception in thread "Receiving Thread" java.lang.LinkageError: loader (instance of org/mule/module/launcher/plugin/MulePluginsClassLoader): attempted duplicate class definition for name: "com/amazonaws/services/sqs/QueueUrlHandler"
Is it possible to read messages from 2 different queues in the same project?
I'm using 3.4.0 CE Mule Server Runtime and 2.4.4 Amazon SQS Connector. I need to stay at these versions. If I switch to 3.5.0 EE Mule Server Runtime, there is no problem in having multiple sqs:receive-messages; it works just as expected. However, it leads to another issue.
Are you using the same credentials in both sqs:config elements? If yes, then you only need one config element and then specify the queue name on the sqs:receive-messages elements.
<sqs:receive-messages queueName="Queue"
preserveMessages="true"
visibilityTimeout="300" />
Refer to the user guide: http://mulesoft.github.io/sqs-connector/2.5.0/mule/sqs-config.html#receive-messages
Running the following config, I set a session variable before an sftp outbound endpoint and after it its not available anymore. I thought session variables were meant to be available across transport barriers? Am I doing something wrong?
<set-session-variable variableName="total" value="#[payload.size()]" />
<foreach>
<!-- Omitted for brevity -->
</foreach>
<sftp:outbound-endpoint encoding="UTF-8"
connector-ref="sftp-out" exchange-pattern="request-response" outputPattern="#[flowVars.filename]"
host="${sftp.host}" port="${sftp.port}" path="${sftp.output.path}" user="${sftp.username}"
responseTimeout="60000" identityFile="${app.home}/${sftp.keyPath}" passphrase="${sftp.passphrase}" />
<logger level="INFO" message="#[sessionVars.total]" />
Being available through transport barrier means that are still available when sending the message through a VM outbound endpoint, inside the same server (same app or different apps).
This is useful for sharing behaviour between flows, use transactions, make asynchronous processing or distribute load in a cluster.
Regards.
I have a SEDA queue that uses the parameter "concurrentConsumers=5". Now, I am trying to integrate it with the Apache Camel Resequencer in order to be able to reorder the messages before processing them, however, when I do this, only one message is processed at a time. I would like to know if it is possible to run several resequencer messages in parallel.
This is my XML code:
<route>
<from uri="seda:barSetup?concurrentConsumers=5" />
<resequence>
<batch-config batchSize="300" batchTimeout="40000"
allowDuplicates="true"/>
<simple>in.header.priority</simple>
<to uri="exec:cat" />
<to uri="bean:batchjobMonitor" />
<to uri="log:output" />
</resequence>
</route>
I am not very familiar with queues or Camel so, sorry if this is a stupid question.
Thanks.
Finally I solved this not using the resequencer. I used the PriorityBlockingQueueFactory and in the comparator I use a similar resequencer to camel:
<bean id="priorityQueueFactory"
class="org.apache.camel.component.seda.PriorityBlockingQueueFactory">
<property name="comparator">
<bean class="com.sg.sgf.service.queues.MyExchangeComparator" />
</property>
</bean>
And then, in the route:
<route>
<from uri="seda:priority?queueFactory=#priorityQueueFactory&size=100&concurrentConsumers=5&pollTimeout=10000" />
<!-- <resequence>
<batch-config batchSize="300" batchTimeout="40000"
allowDuplicates="true" />
<simple>in.header.priority</simple> -->
<to uri="exec:cat" /> <!-- the actual executable is set in the job that is passed to the queue -->
<to uri="bean:batchjobMonitor" />
<to uri="log:output" />
<!-- </resequence> -->
</route>
With this, I have what I wanted.
I have a flow where I receive request via webservice. I forward that request to a JMS queue using component binding. However, I would like to get async-reply from that queue and use it as response to the webservice. Do I need to use reply-to and async-reply-router in the flow? Or is there any other way to do that in Mule 3? Any pointers?
<flow name="mviService">
<http:inbound-endpoint address="http://localhost:62005/mvi"
exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" />
</http:inbound-endpoint>
<component class="com.pennmutual.services.mvi.MVIServiceImpl">
<binding interface="com.pennmutual.mvi.helper.XMLReqProcessorInterface"
method="process121Order">
<jms:outbound-endpoint queue="mviq.121.order" />
</binding>
</component>
<async-reply>
</async-reply>
</flow>
============ EDITED - SEE BELOW FOR RE-FRAMED QUESTION =================
I think I haven't done a good job in describing the scenario. Let me try again. Here's the scenario --
A client calls our service described in this flow "mviService". mviService gets XML request via HTTP/SOAP based inbound endpoint. Let's call this request as XML121Request.4
A component defined in MVI "com.xyz.services.mvi.MVIServiceImpl" makes some changes in XML121Request.
Forwards this XML121 to a JMS queue "mviq.121.order". It uses component binding for this.
The outbound endpoint to this JMS queue is a third party web service where this request is forwarded. The third party acknowledges the receipt of XML121 and the synchronous web service call returns.
The response from that third party service comes at a later point of time, which is generally couple of seconds. The response comes asynchronously. Third party invokes another webservice endpoint on MVI and sends the XML121Response.
MVI puts this response in a JMS queue named "mviq.async.service.reply".
The "mviService" flow needs to wait for this response and send this response (after some modification) to caller(in step 1).
I'm able to get the response from third party and this response is enqued in a queue named "mviq.async.service.reply". I would like to use/consume this message and return it as a response to first call to MVI.
I'm trying to use "request-reply".
<request-reply timeout="60000">
<vm:outbound-endpoint path="request" />
<jms:inbound-endpoint queue="mviq.async.service.reply"
exchange-pattern="one-way" />
</request-reply>
THe problem is that even though I don't want to have outbound-endpoint in this case, I still have to put one as this is required by request-reply tag. The flow waits for 60 seconds at that point of time but even if I put something in the queue "mviq.async.service.reply" the correlation ID doesn't match so the service timesout and returns an error.
flow is mentioned below.
<flow name="mviService">
<http:inbound-endpoint address="http://localhost:62005/mvi"
exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" />
</http:inbound-endpoint>
<component class="com.pennmutual.services.mvi.MVIServiceImpl">
<binding interface="com.xyz.mvi.helper.XMLReqProcessorInterface"
method="process121Order">
<jms:outbound-endpoint queue="mviq.121.order" />
</binding>
</component>
<!-- <logger message="XML Correlation ID 1 is #[mule:message.headers(all)]" /> -->
<request-reply timeout="60000">
<vm:outbound-endpoint path="request" /> <!-- we don't care about this -->
<jms:inbound-endpoint queue="mviq.async.service.reply"
exchange-pattern="one-way" />
</request-reply>
<!-- <component class="com.xyz.mvi.CreateMVIServiceResponse"/> -->
</flow>
===== FLow with REPLY TO =============
<flow name="mviService">
<http:inbound-endpoint address="http://localhost:62005/mvi"
exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.xyz.services.mvi.MVIServicePortType" />
</http:inbound-endpoint>
<component class="com.xyz.services.mvi.MVIServiceImpl">
<binding interface="com.xyz.mvi.helper.XMLReqProcessorInterface"
method="process121Order">
<jms:outbound-endpoint queue="mviq.121.order" exchange-pattern="request-response">
<message-properties-transformer scope="outbound">
<add-message-property key="MULE_REPLYTO" value="mviq.async.service.reply" />
</message-properties-transformer>
</jms:outbound-endpoint>
</binding>
</component>
</flow>
I'd like to suggest you do not create a service component class and instead use cxf:proxy-service, which will give you direct access to the SOAP envelope and the opportunity to assemble the response the way you want at XML level.
This will free you from the constraint a service component class imposes on you, hence waive the need to use bindings and open the door to using request-response.
See this SO answer and check the (skinny) proxy service user guide for more information.
I am trying to setup a simple demo of activemq and mina. I edited the camelContext in the activemq.xml file to include two mina tcp sockets, two queues and routes as such:
listenerA -> qA -> listenerB
listenerB -> qB -> listenerA
The intent is to have two way pass through between two telnet sessions. Later, I will add more fancy features such as filtering, routing to a topic and my own codec on each listener.
Here is my camelcontext:
<!-- You can use a <package> element for each root package to search for Java routes -->
<package>com.myco.codec</package>
<endpoint id="listener_A" uri="mina:tcp://localhost:42000?textline=true"/>
<endpoint id="listener_B" uri="mina:tcp://localhost:42001?textline=true"/>
<!-- You can use Spring XML syntax to define the routes here using the <route> element -->
<route>
<from ref="listener_A"/>
<to uri="activemq:qA"/>
</route>
<route>
<from uri="activemq:qB"/>
<to ref="listener_A"/>
</route>
<route>
<from ref="listener_B"/>
<to uri="activemq:qB"/>
</route>
<route>
<from uri="activemq:qA"/>
<to ref="listener_B"/>
</route>
</camelContext>
When I start activemq I get an exception:
org.apache.camel.NoSuchEndpointException: No endpoint could be found for: mina:tcp://localhost:42000?textline=true
Do I explicitly need to add a mina bean? If so where and how?
Do you have camel-mina.jar and the mina jars on the classpath?
Based on the thread here it seems to have fixed it.