use of org.apache.activemq.camel.component.ActiveMQComponent in project camel by apache.
the class JmsRouteRequestReplyTest method init.
protected static void init() {
if (inited.compareAndSet(false, true)) {
ContextBuilder contextBuilderMessageID = new ContextBuilderMessageID();
ContextBuilder contextBuilderCorrelationID = new ContextBuilder() {
public CamelContext buildContext(CamelContext context) throws Exception {
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setUseMessageIDAsCorrelationID(false);
jmsComponent.setConcurrentConsumers(maxServerTasks);
context.addComponent(componentName, jmsComponent);
return context;
}
};
ContextBuilder contextBuilderMessageIDNamedReplyToSelector = new ContextBuilder() {
public CamelContext buildContext(CamelContext context) throws Exception {
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setUseMessageIDAsCorrelationID(true);
jmsComponent.setConcurrentConsumers(maxServerTasks);
jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
context.addComponent(componentName, jmsComponent);
return context;
}
};
ContextBuilder contextBuilderCorrelationIDNamedReplyToSelector = new ContextBuilder() {
public CamelContext buildContext(CamelContext context) throws Exception {
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setUseMessageIDAsCorrelationID(false);
jmsComponent.setConcurrentConsumers(maxServerTasks);
jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
context.addComponent(componentName, jmsComponent);
return context;
}
};
ContextBuilder contextBuilderCorrelationIDDiffComp = new ContextBuilder() {
public CamelContext buildContext(CamelContext context) throws Exception {
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setConcurrentConsumers(maxServerTasks);
context.addComponent(componentName, jmsComponent);
ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
jmsComponent1.setConnectionFactory(connectionFactory);
jmsComponent1.setUseMessageIDAsCorrelationID(false);
jmsComponent1.setConcurrentConsumers(maxServerTasks);
context.addComponent(componentName1, jmsComponent1);
return context;
}
};
ContextBuilder contextBuilderMessageIDDiffComp = new ContextBuilder() {
public CamelContext buildContext(CamelContext context) throws Exception {
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
jmsComponent.setConnectionFactory(connectionFactory);
jmsComponent.setUseMessageIDAsCorrelationID(true);
jmsComponent.setConcurrentConsumers(maxServerTasks);
context.addComponent(componentName, jmsComponent);
ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
jmsComponent1.setConnectionFactory(connectionFactory);
jmsComponent1.setUseMessageIDAsCorrelationID(true);
jmsComponent1.setConcurrentConsumers(maxServerTasks);
context.addComponent(componentName1, jmsComponent1);
return context;
}
};
contextBuilders.put("testUseMessageIDAsCorrelationID", contextBuilderMessageID);
contextBuilders.put("testUseCorrelationID", contextBuilderCorrelationID);
contextBuilders.put("testUseMessageIDAsCorrelationIDMultiNode", contextBuilderMessageID);
contextBuilders.put("testUseCorrelationIDMultiNode", contextBuilderCorrelationID);
contextBuilders.put("testUseMessageIDAsCorrelationIDPersistReplyToMultiNode", contextBuilderMessageID);
contextBuilders.put("testUseCorrelationIDPersistReplyToMultiNode", contextBuilderCorrelationID);
contextBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode", contextBuilderMessageID);
// contextBuilders.put("testUseCorrelationIDPersistMultiReplyToMultiNode", contextBuilderCorrelationID);
contextBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", contextBuilderMessageIDNamedReplyToSelector);
contextBuilders.put("testUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", contextBuilderCorrelationIDNamedReplyToSelector);
contextBuilders.put("testUseCorrelationIDMultiNodeDiffComponents", contextBuilderCorrelationIDDiffComp);
contextBuilders.put("testUseMessageIDAsCorrelationIDMultiNodeDiffComponents", contextBuilderMessageIDDiffComp);
contextBuilders.put("testUseMessageIDAsCorrelationIDTimeout", contextBuilderMessageID);
contextBuilders.put("testUseCorrelationIDTimeout", contextBuilderMessageID);
routeBuilders.put("testUseMessageIDAsCorrelationID", new SingleNodeRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerComponent", new SingleNodeRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerProducer", new SingleNodeRouteBuilder());
routeBuilders.put("testUseCorrelationID", new SingleNodeRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDMultiNode", new MultiNodeRouteBuilder());
routeBuilders.put("testUseCorrelationIDMultiNode", new MultiNodeRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDPersistReplyToMultiNode", new MultiNodeRouteBuilder());
routeBuilders.put("testUseCorrelationIDPersistReplyToMultiNode", new MultiNodeRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode", new MultiNodeReplyToRouteBuilder());
// routeBuilders.put("testUseCorrelationIDPersistMultiReplyToMultiNode", new MultiNodeReplyToRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", new MultiNodeReplyToRouteBuilder());
routeBuilders.put("testUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", new MultiNodeReplyToRouteBuilder());
routeBuilders.put("testUseCorrelationIDMultiNodeDiffComponents", new MultiNodeDiffCompRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDMultiNodeDiffComponents", new MultiNodeDiffCompRouteBuilder());
routeBuilders.put("testUseMessageIDAsCorrelationIDTimeout", new SingleNodeDeadEndRouteBuilder());
routeBuilders.put("testUseCorrelationIDTimeout", new SingleNodeDeadEndRouteBuilder());
}
}
use of org.apache.activemq.camel.component.ActiveMQComponent in project camel by apache.
the class WidgetApplication method createActiveMQComponent.
/**
* Factory to create the {@link ActiveMQComponent} which is used in this application
* to connect to the remote ActiveMQ broker.
*/
@Produces
public static ActiveMQComponent createActiveMQComponent() {
// you can set other options but this is the basic just needed
ActiveMQComponent amq = new ActiveMQComponent();
// The ActiveMQ Broker allows anonymous connection by default
// amq.setUserName("admin");
// amq.setPassword("admin");
// the url to the remote ActiveMQ broker
amq.setBrokerURL("tcp://localhost:61616");
return amq;
}
use of org.apache.activemq.camel.component.ActiveMQComponent in project camel by apache.
the class WidgetMain method createActiveMQComponent.
public static ActiveMQComponent createActiveMQComponent() {
// you can set other options but this is the basic just needed
ActiveMQComponent amq = new ActiveMQComponent();
// The ActiveMQ Broker allows anonymous connection by default
// amq.setUserName("admin");
// amq.setPassword("admin");
// the url to the remote ActiveMQ broker
amq.setBrokerURL("tcp://localhost:61616");
return amq;
}
use of org.apache.activemq.camel.component.ActiveMQComponent in project camel by apache.
the class JmsHammerTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ActiveMQComponent activemq = activeMQComponent("vm://localhost?broker.persistent=false&broker.useJmx=false&jms.redeliveryPolicy.maximumRedeliveries=0" + "&jms.redeliveryPolicy.initialRedeliveryDelay=500&jms.useAsyncSend=false&jms.sendTimeout=10000" + "&jms.maxReconnectAttempts=1&jms.timeout=3000");
camelContext.addComponent("activemq", activemq);
return camelContext;
}
Aggregations