mirror of https://github.com/apache/activemq.git
Removes deps on camel from activemq-web, code not needed for the examples.
This commit is contained in:
parent
efaa351db7
commit
062adbbe72
|
@ -32,7 +32,6 @@
|
|||
<properties>
|
||||
<activemq.osgi.import.pkg>
|
||||
org.apache.activemq*;resolution:=optional,
|
||||
org.apache.camel*;resolution:=optional,
|
||||
org.eclipse.jetty*;resolution:=optional,
|
||||
org.springframework*;resolution:=optional,
|
||||
com.thoughtworks.xstream*;resolution:=optional,
|
||||
|
@ -46,9 +45,10 @@
|
|||
|
||||
<dependencies>
|
||||
<!-- activemq -->
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-camel</artifactId>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>activemq-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
|
|
|
@ -129,28 +129,11 @@ public class MessageServlet extends MessageServletSupport {
|
|||
boolean sync = isSync(request);
|
||||
TextMessage message = client.getSession().createTextMessage(text);
|
||||
|
||||
if (sync) {
|
||||
String point = "activemq:"
|
||||
+ ((ActiveMQDestination)destination).getPhysicalName().replace("//", "")
|
||||
+ "?requestTimeout=" + requestTimeout;
|
||||
try {
|
||||
String body = (String)client.getProducerTemplate().requestBody(point, text);
|
||||
ActiveMQTextMessage answer = new ActiveMQTextMessage();
|
||||
answer.setText(body);
|
||||
|
||||
writeMessageResponse(response.getWriter(), answer);
|
||||
} catch (Exception e) {
|
||||
IOException ex = new IOException();
|
||||
ex.initCause(e);
|
||||
throw ex;
|
||||
}
|
||||
} else {
|
||||
appendParametersToMessage(request, message);
|
||||
boolean persistent = isSendPersistent(request);
|
||||
int priority = getSendPriority(request);
|
||||
long timeToLive = getSendTimeToLive(request);
|
||||
client.send(destination, message, persistent, priority, timeToLive);
|
||||
}
|
||||
appendParametersToMessage(request, message);
|
||||
boolean persistent = isSendPersistent(request);
|
||||
int priority = getSendPriority(request);
|
||||
long timeToLive = getSendTimeToLive(request);
|
||||
client.send(destination, message, persistent, priority, timeToLive);
|
||||
|
||||
// lets return a unique URI for reliable messaging
|
||||
response.setHeader("messageID", message.getJMSMessageID());
|
||||
|
|
|
@ -49,12 +49,6 @@ import org.apache.activemq.ActiveMQConnectionFactory;
|
|||
import org.apache.activemq.MessageAvailableConsumer;
|
||||
import org.apache.activemq.broker.BrokerRegistry;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.camel.component.ActiveMQComponent;
|
||||
import org.apache.activemq.camel.component.ActiveMQConfiguration;
|
||||
import org.apache.activemq.pool.PooledConnectionFactory;
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.ProducerTemplate;
|
||||
import org.apache.camel.impl.DefaultCamelContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -88,9 +82,6 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
|
|||
|
||||
private final Semaphore semaphore = new Semaphore(1);
|
||||
|
||||
private CamelContext camelContext;
|
||||
private ProducerTemplate producerTemplate;
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
|
@ -185,16 +176,12 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
|
|||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
if (producerTemplate != null) {
|
||||
producerTemplate.stop();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("caught exception closing consumer", e);
|
||||
} finally {
|
||||
producer = null;
|
||||
session = null;
|
||||
connection = null;
|
||||
producerTemplate = null;
|
||||
if (consumers != null) {
|
||||
consumers.clear();
|
||||
}
|
||||
|
@ -314,27 +301,6 @@ public class WebClient implements HttpSessionActivationListener, HttpSessionBind
|
|||
servletContext.setAttribute(CONNECTION_FACTORY_ATTRIBUTE, factory);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized CamelContext getCamelContext() {
|
||||
if (camelContext == null) {
|
||||
LOG.debug("Creating camel context");
|
||||
camelContext = new DefaultCamelContext();
|
||||
ActiveMQConfiguration conf = new ActiveMQConfiguration();
|
||||
conf.setConnectionFactory(new PooledConnectionFactory((ActiveMQConnectionFactory)factory));
|
||||
ActiveMQComponent component = new ActiveMQComponent(conf);
|
||||
camelContext.addComponent("activemq", component);
|
||||
}
|
||||
return camelContext;
|
||||
}
|
||||
|
||||
public synchronized ProducerTemplate getProducerTemplate() throws Exception {
|
||||
if (producerTemplate == null) {
|
||||
LOG.debug("Creating producer template");
|
||||
producerTemplate = getCamelContext().createProducerTemplate();
|
||||
producerTemplate.start();
|
||||
}
|
||||
return producerTemplate;
|
||||
}
|
||||
|
||||
public synchronized MessageProducer getProducer() throws JMSException {
|
||||
if (producer == null) {
|
||||
|
|
Loading…
Reference in New Issue