I am using Mule community-3.8 version. I have a scenario where i need to connect MQ via JMS and should have retry strategy connection in forever mode. It is working fine on the happy scenario incase of MQ/channel restart happened.
But in case of queue manager down and Mule tries to connect forever, then that moment I couldn't able to undeploy the flows even if I remove the flow directory and anchor file as well still it retries.
I feel this is an open bug in Mule? Can anyone suggest is this the existing behaviour?
Code snippet
<spring:beans>
<spring:bean id="ConnectionFactory" name="ConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
</spring:bean>
</spring:beans>
<jms:connector name="jms-conn" username="xxxx" password="xxxx" specification="1.1" connectionFactory-ref="ConnectionFactory" validateConnections="true" numberOfConsumers="1" persistentDelivery="true">
<reconnect-forever frequency="30000" />
</jms:connector>
Moreover, I am able to undeploy the flow if i use blocking=false in the jms:connector. But I really don't need that feature to be there in my usecase.
JMS retry option will work in a single thread model, hence this can hold the new thread process until this gets reconnected successfully.
Related
We're using Apache James 3.0-beta4 which uses embedded ActiveMQ 5.5.0 for FIFO message queue, and sometimes messages get stuck. Therefore, we need to monitor it. Is there any way to monitor an ActiveMQ queue like message size and most recent message-id in the queue (if possible).
In the JAMES spring-server.xml I found that:
<amq:broker useJmx="true" persistent="true" brokerName="james" dataDirectory="filesystem=file://var/store/activemq/brokers" useShutdownHook="false" schedulerSupport="false" id="broker">
<amq:destinationPolicy>
<amq:policyMap>
<amq:policyEntries>
<!-- Support priority handling of messages -->
<!-- http://activemq.apache.org/how-can-i-support-priority-queues.html -->
<amq:policyEntry queue=">" prioritizedMessages="true"/>
</amq:policyEntries>
</amq:policyMap>
</amq:destinationPolicy>
<amq:managementContext>
<amq:managementContext createConnector="false"/>
</amq:managementContext>
<amq:persistenceAdapter>
<amq:amqPersistenceAdapter/>
</amq:persistenceAdapter>
<amq:plugins>
<amq:statisticsBrokerPlugin/>
</amq:plugins>
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
also one old part from readme:
- Telnet Management has been removed in favor of JMX with client shell
- More metrics counters available via JMX
...
* Monitor via JMX (launch any JMX client and connect to URL=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi)
which is confusion on how to use it.
This is part of the bigger "monolith" project which now is recreated for microservices but still need to be supported ;) All was fine till mid of March.
It looks like ActiveMQ management and monitoring is not possible because JMX is disabled.
Alternatively, you could remove until-successful and use an inbound VM or JMS endpoint with transactional delivery to perform retries on the outbound FTP endpoint.
could you please provide me the example on this with VM?
this related to below question
how to make until successful as synchronous to retry mechanism for FTP Outbound in mule 3.4.2
How about try something like the below
<flow name="transactionalVM">
<vm:inbound-endpoint path="orders" exchange-pattern="one-way">
<vm:transaction action="ALWAYS_BEGIN"/>
</vm:inbound-endpoint>
<file:outbound-endpoint ref="receivedOrders"/> <!-- replace this with your FTP endpoint -->
</flow>
Look at transaction management in Mule to figure out how the retries can be controlled, right now its going to try endlessly
Now if you are wondering how the file outbound is part of the transaction have a look at this (Configuration Tips and Tricks) and this, hint here
I used retry mechanism for outbound FTP by using Untill successful. It is working fine but it is working as asynchronously in mule 3.4.2.I have seen synchronous option is avaliable in 3.5. is it possible to make untill successful scope working as synchronous in 3.4.2 version? if possible could u please provide me the solution? or else any other solution to use retry mechanism for outbound FTP?
<until-successful objectStore-ref="objectStore" maxRetries="3" secondsBetweenRetries="1" doc:name="Until Successful">
<ftp:outbound-endpoint host="10.10.10.10" port="7055" path="#[flowVars.FTPConfig.getPath()]" user="user" password="password" outputPattern="${filename}" responseTimeout="20000" doc:name="FTP" connector-ref="FTP"/>
</until-successful>
No, it is not possible to make until-successful synchronous in Mule 3.4. You need to upgrade to version 3.5, or even 3.6 which is available at this writing.
Alternatively, you could remove until-successful and use an inbound VM or JMS endpoint with transactional delivery to perform retries on the outbound FTP endpoint.
I'm started to work with Mule and Mule Studio (version 3.5): my goal is rewriting some flows that now is workign, but with a bad syntax.
In this moment I have a flow with some JMS connector and JMS endpoint for acquiring data (my flows are using ActiveMQ 5.10): the configuration XML file is ok and I want to test this flow, but I have'nt a big experience in JMS and system integration.
I think to create a JMS producer and, into run,
start up Mule (with all his flows, endpoints, etc, JMS queues);
start the JMS producer: in run the producer
links to name queue defined in configuration Mule
create a message
send this message to Mule
And the test asserts the
Mule receive the message by the producer
Mule don't loss the message
Mule turn this message to correct flow and relative elaboration
My problem is the lack of manuality and pratical work-ability to link Mule and producer: I tried to use http://activemq.apache.org/hello-world.html but the code is useless for me because it work correctly without Mule, but in my case the tests has to fail if Mule is stopped.
Has everybody any suggest, please?
Just set up an activemq connector without addresss, that will use the default address of vm://localhost that instructs the connector and activemq to act as a local embedded server.
<jms:activemq-connector name="JmsConnector" specification="1.1" />
I have an issue with ActiveMQ loadbalancing with Mule. I am using Mule 3.2.0 and ActiveMQ 5.5.1
I have a Mule FLow application which uses JMS inbound Endpoint to listen to queues in ActiveMQ.
I have 2 instances of AMQ running each having a queue called "MyQueue".
Lets name them AMQ1 and AMQ2.
I also have 2 mule instances running - each having the same app. Let's name them Mule1 and Mule2.
Now I want each mule instance to pick up messages from either of the AMQ queues. So say a Message Sender sends the message to the queue MyQueue in either AMQ1 or AMQ2 (Message sender load balances using failover transport supported by ActiveMQ - and that bit works fine). Say it reached AMQ1. Now ideally I would like to have 10 consumers each of Mule1 and Mule2 registered in each AMQ instance. So both of them are listening for incoming messages in both the queues. One of them should pick up the message from the queue and process it.
This is the config I am using in Mule to connect to both the AMQ brokers.
<jms:activemq-connector name="Active_MQ" brokerURL="failover:tcp://10.0.64.158:61616,tcp://10.0.64.160:61616)?randomize=true" eagerConsumer="true" numberOfConsumers="10" dynamicNotification="true" validateConnections="true" clientId="MuleInstance1" doc:name="Active MQ">
<reconnect count="5" frequency="3000" blocking="false"/>
</jms:activemq-connector>
kindly note clientId is different for different Mule instances. Also currently AMQ 1 and Mule1 share the same machine and AMQ2 and Mule2 share another machine.
However I am noticing soem random behaviour. AT times all consumers(both of Mule1 and Mule2) register only to one AMQ instance. At times Mule1 is registering only to AMQ1 and Mule 2 to AMQ2.
What ideally I want is cosnumers of both Mule1 and Mule2 to register to both AM1 and AMQ2
I followed the instructions here
http://www.mulesoft.org/documentation-3.2/display/MULE3USER/ActiveMQ+Integration
Basically I wanted to use the network of broker architecture so that there is no loss of service whether a Mule instance or AMQ instance goes down or has to be restarted.
Not sure the randomize=true query param in helping in this case.
Can someone kindly advise how to achieve the above using Mule 3.2.0 and Active MQ 5.5.1?
If there isn't a solution sadly I may have to make Mule1 listen to AMQ1 and Mule2 listen to only AMQ2 and it won't really be clustered :(
Thanks in advance.
Got it working.
Got a suggestion the Mule forum itself.
http://forum.mulesoft.org/mulesoft/topics/activemq_loadbalancing_with_mule
So basically instead of relying on AMQ load balancing for the consumer I used 2 AMQ connectors and used a composite source in each mule app listenign to 2 Inbound EndPoints. And it works a treat. Bringing up/Shutting down Mule and AMQ instances - all worked a treat. here's teh config
<jms:activemq-connector name="Active_MQ_1" brokerURL="failover: (tcp://10.0.64.158:61616)" eagerConsumer="true" numberOfConsumers="10" dynamicNotification="true" validateConnections="true" clientId="MuleInstance1" doc:name="Active MQ">
<reconnect count="5" frequency="3000" blocking="false"/>
</jms:activemq-connector>
<jms:activemq-connector name="Active_MQ_2" brokerURL="failover:(tcp://10.0.64.160:61616)" eagerConsumer="true" numberOfConsumers="10" dynamicNotification="true" validateConnections="true" clientId="MuleInstance1" doc:name="Active MQ">
<reconnect count="5" frequency="3000" blocking="false"/>
</jms:activemq-connector>
Now refer to that from within your flow with composite-source
<flow name="MyAutomationFlow" doc:name="MyAutomationFlow">
<composite-source>
<jms:inbound-endpoint queue="MyOrderQ" connector-ref="Active_MQ1" doc:name="JMS Inbound Endpoint"/>
<jms:inbound-endpoint queue="MyOrderQ" connector-ref="Active_MQ2" doc:name="JMS Inbound Endpoint"/>
</composite-source>
........
Worked a treat!