mirror of https://github.com/apache/activemq.git
- Added means to configure the prefetch and optimizeAcknowledge setting of the connectionFactory in the WebClient.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@405397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9614aa9b4e
commit
2391cb0d17
|
@ -64,6 +64,8 @@ import edu.emory.mathcs.backport.java.util.concurrent.Semaphore;
|
||||||
public class WebClient implements HttpSessionActivationListener, HttpSessionBindingListener, Externalizable {
|
public class WebClient implements HttpSessionActivationListener, HttpSessionBindingListener, Externalizable {
|
||||||
public static final String webClientAttribute = "org.apache.activemq.webclient";
|
public static final String webClientAttribute = "org.apache.activemq.webclient";
|
||||||
public static final String connectionFactoryAttribute = "org.apache.activemq.connectionFactory";
|
public static final String connectionFactoryAttribute = "org.apache.activemq.connectionFactory";
|
||||||
|
public static final String connectionFactoryPrefetch = "org.apache.activemq.connectionFactory.prefetch";
|
||||||
|
public static final String connectionFactoryOptimizeAck = "org.apache.activemq.connectionFactory.optimizeAck";
|
||||||
public static final String brokerUrlInitParam = "org.apache.activemq.brokerURL";
|
public static final String brokerUrlInitParam = "org.apache.activemq.brokerURL";
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(WebClient.class);
|
private static final Log log = LogFactory.getLog(WebClient.class);
|
||||||
|
@ -93,6 +95,7 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
|
||||||
client = WebClient.createWebClient(request);
|
client = WebClient.createWebClient(request);
|
||||||
session.setAttribute(webClientAttribute, client);
|
session.setAttribute(webClientAttribute, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -233,6 +236,19 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveMQConnectionFactory amqfactory = new ActiveMQConnectionFactory(brokerURL);
|
ActiveMQConnectionFactory amqfactory = new ActiveMQConnectionFactory(brokerURL);
|
||||||
|
|
||||||
|
// Set prefetch policy for factory
|
||||||
|
if (servletContext.getInitParameter(connectionFactoryPrefetch) != null) {
|
||||||
|
int prefetch = Integer.valueOf(servletContext.getInitParameter(connectionFactoryPrefetch)).intValue();
|
||||||
|
amqfactory.getPrefetchPolicy().setAll(prefetch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set optimize acknowledge setting
|
||||||
|
if (servletContext.getInitParameter(connectionFactoryOptimizeAck) != null) {
|
||||||
|
boolean optimizeAck = Boolean.valueOf(servletContext.getInitParameter(connectionFactoryOptimizeAck)).booleanValue();
|
||||||
|
amqfactory.setOptimizeAcknowledge(optimizeAck);
|
||||||
|
}
|
||||||
|
|
||||||
factory = amqfactory;
|
factory = amqfactory;
|
||||||
|
|
||||||
servletContext.setAttribute(connectionFactoryAttribute, factory);
|
servletContext.setAttribute(connectionFactoryAttribute, factory);
|
||||||
|
|
Loading…
Reference in New Issue