This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes SOA and ESB and the fly likes Multiple consumer retry in websphere MQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » SOA and ESB
Bookmark "Multiple consumer retry in websphere MQ" Watch "Multiple consumer retry in websphere MQ" New topic

Multiple consumer retry in websphere MQ

Anish Kuti

Joined: May 12, 2008
Posts: 29
In my application Mule (v2.2.1) is listing to WMQ and we have defined 10 consumer for the Mule connector.
We have implemented retry policy also as below .
So 10 consumer is listing the queue and now due to some unwanted reason some consumer are getting disconnected , due to that huge backlog is getting created in MQ.
We want - if any consumer is getting disconnected i.e if consumer number <10 then MULE should retry and will get 10 consumer. how could we do that ?
In our case when all the consumer is getting down then only MULE is retrying i.e retrying only in case of connector down .
we want retry in case of consumer is down also.

Spring Config:
<bean id="threadingPolicyTemplate"
<constructor-arg index="0">
<bean class="com.test.platform.mule.mqpolicies.policies.SimpleRetryPolicyTemplate">
<constructor-arg index="0" value="15000"/>
<constructor-arg index="1" value="1"/>

Java Class:
import java.util.Map;


import org.mule.api.context.WorkManager;
import org.mule.api.retry.RetryCallback;
import org.mule.api.retry.RetryContext;
import org.mule.api.retry.RetryNotifier;
import org.mule.api.retry.RetryPolicy;
import org.mule.api.retry.RetryPolicyTemplate;
import org.mule.retry.RetryPolicyExhaustedException;
import org.mule.util.concurrent.Latch;

import com.test.platform.mule.mqpolicies.policies.RetryForeverPolicyTemplate;

* The Class AsynchronousRetryTemplate.
public class AsynchronousRetryTemplate implements RetryPolicyTemplate {
/** The Constant RETRY_TEMPLTE_300000. */
private static final String RETRY_TEMPLTE_300000 = "300000";

/** The delegate. */
private final RetryPolicyTemplate delegate;

/** The start latch. */
private Latch startLatch;

* Instantiates a new asynchronous retry template.
* @param delegate the delegate
public AsynchronousRetryTemplate(RetryPolicyTemplate delegate) {
this.delegate = delegate;

* Execute.
* @param callback the callback
* @param workManager the work manager
* @return the retry context
* @throws Exception the exception
public RetryContext execute(RetryCallback callback, WorkManager workManager)
throws Exception {
RetryWorker worker = new RetryWorker(this.delegate, callback, workManager, this.startLatch);
FutureRetryContext context = worker.getRetryContext();

try {
System.out.println("After Inside sync block****");
System.out.println("After Do Work" + context.isOk());
} catch (Exception e) {
System.out.println("****Inside Exception block****");

try {
RetryPolicyTemplate delegateForever = new RetryForeverPolicyTemplate(Long.parseLong(RETRY_TEMPLTE_300000));
RetryWorker workerTemp = new RetryWorker(delegateForever, callback, workManager, this.startLatch);
FutureRetryContext contextTemp = workerTemp.getRetryContext();
System.out.println("Inside Async block****");

return contextTemp;
} catch (WorkException w) {
throw new RetryPolicyExhaustedException(w, null);

return context;
Mule Config:
<jms:connector name="mqConnector"
<spring:property name="retryPolicyTemplate" ref="threadingPolicyTemplate" />
<spring:property name="jmsSupport" ref="customJmsSupport" />
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

have you checked Mule WMQ Transport Reference? Also, why you prefer Mule? Is it any better than WSO2 ESB (for instance)?
wood burning stoves
subject: Multiple consumer retry in websphere MQ
Similar Threads
Neded Help in EJB3.0 timers
refreshing the page automatically if the configuration file changes
Urgent help - DB2 type 4 driver returns 0E-8 for decimal value
How to deploy MDP on DM Server?
Problem getting Bean reference which is in jar from JSP