Search in sources :

Example 16 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project camel by apache.

the class JmsTestSupport method createCamelContext.

/*
     * @see org.apache.camel.test.junit4.CamelTestSupport#createCamelContext()
     * @return
     * @throws Exception
     */
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUri);
    connection = connectionFactory.createConnection();
    connection.start();
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    SjmsComponent component = new SjmsComponent();
    component.setConnectionCount(1);
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 17 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project camel by apache.

the class BatchTransactedProducerSupport method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(getBrokerUri());
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 18 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project camel by apache.

the class TransactedConsumerSupport method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(getBrokerUri());
    // use low redelivery delay to speed
    connectionFactory.getRedeliveryPolicy().setInitialRedeliveryDelay(100);
    connectionFactory.getRedeliveryPolicy().setRedeliveryDelay(100);
    connectionFactory.getRedeliveryPolicy().setUseCollisionAvoidance(false);
    connectionFactory.getRedeliveryPolicy().setUseExponentialBackOff(false);
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 19 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project camel by apache.

the class ManualBatchFromQueueTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("testStrategy", new ListAggregationStrategy());
    CamelContext camel = new DefaultCamelContext(registry);
    SjmsBatchComponent sjms = new SjmsBatchComponent();
    sjms.setAsyncStartListener(true);
    log.info("Using live connection to existing ActiveMQ broker running on {}", url);
    sjms.setConnectionFactory(new ActiveMQConnectionFactory(url));
    camel.addComponent("sjms-batch", sjms);
    return camel;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) SjmsBatchComponent(org.apache.camel.component.sjms.batch.SjmsBatchComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ListAggregationStrategy(org.apache.camel.component.sjms.batch.ListAggregationStrategy)

Example 20 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project camel by apache.

the class ManualFromQueueTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camel = super.createCamelContext();
    SjmsComponent sjms = new SjmsComponent();
    log.info("Using live connection to existing ActiveMQ broker running on {}", url);
    sjms.setConnectionFactory(new ActiveMQConnectionFactory(url));
    camel.addComponent("sjms", sjms);
    return camel;
}
Also used : CamelContext(org.apache.camel.CamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Aggregations

ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)69 CamelContext (org.apache.camel.CamelContext)25 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)16 ConnectionFactory (javax.jms.ConnectionFactory)11 Test (org.junit.Test)10 PooledConnectionFactory (org.apache.activemq.pool.PooledConnectionFactory)9 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)8 JmsTemplate (org.springframework.jms.core.JmsTemplate)7 Connection (javax.jms.Connection)6 Session (javax.jms.Session)6 Before (org.junit.Before)5 MessageProducer (javax.jms.MessageProducer)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)4 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)4 File (java.io.File)3 Destination (javax.jms.Destination)3 JMSException (javax.jms.JMSException)3 MessageConsumer (javax.jms.MessageConsumer)3 BrokerService (org.apache.activemq.broker.BrokerService)3 ArrayList (java.util.ArrayList)2