Search in sources :

Example 11 with SjmsComponent

use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.

the class Jms method sjms.

@Produces
@Named("sjms")
@ApplicationScoped
SjmsComponent sjms() {
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useShutdownHook=false&broker.useJmx=false"));
    component.setConnectionCount(maxConnections);
    return component;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 12 with SjmsComponent

use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.

the class SjmsBatchConsumerAsyncStartTest method createCamelContext.

// lets just test that any of the existing tests works
@Override
public CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("testStrategy", new ListAggregationStrategy());
    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getTcpConnectorUri());
    SjmsComponent sjmsComponent = new SjmsComponent();
    sjmsComponent.setConnectionFactory(connectionFactory);
    SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
    sjmsBatchComponent.setConnectionFactory(connectionFactory);
    // turn on async start listener
    sjmsBatchComponent.setAsyncStartListener(true);
    CamelContext context = new DefaultCamelContext(registry);
    context.addComponent("sjms", sjmsComponent);
    context.addComponent("sjms-batch", sjmsBatchComponent);
    return context;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ConnectionFactory(javax.jms.ConnectionFactory) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 13 with SjmsComponent

use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.

the class TransactedProducerInOutErrorTest method test.

@Test(expected = IllegalArgumentException.class)
public void test() throws Exception {
    CamelContext context = new DefaultCamelContext();
    context.addRoutes(createRouteBuilder());
    SjmsComponent component = context.getComponent("sjms", SjmsComponent.class);
    component.setConnectionFactory(CamelJmsTestHelper.createConnectionFactory());
    try {
        context.start();
    } catch (Throwable t) {
        LOG.info("Exception was thrown as expected", t);
        throw t;
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 14 with SjmsComponent

use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.

the class TransactedQueueProducerTest method createCamelContext.

/*
     * @see org.apache.camel.test.junit4.CamelTestSupport#createCamelContext()
     * @return
     * @throws Exception
     */
@Override
protected CamelContext createCamelContext() throws Exception {
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
    CamelContext camelContext = super.createCamelContext();
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) CamelContext(org.apache.camel.CamelContext) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 15 with SjmsComponent

use of org.apache.camel.component.sjms.SjmsComponent in project camel by apache.

the class InOnlyTopicDurableConsumerTest method createCamelContext.

/*
     * @see org.apache.camel.test.junit4.CamelTestSupport#createCamelContext()
     *
     * @return
     * @throws Exception
     */
@Override
protected CamelContext createCamelContext() throws Exception {
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(BROKER_URI);
    ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
    connectionResource.setConnectionFactory(connectionFactory);
    connectionResource.setClientId(CONNECTION_ID);
    CamelContext camelContext = super.createCamelContext();
    SjmsComponent component = new SjmsComponent();
    component.setConnectionResource(connectionResource);
    component.setConnectionCount(1);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) CamelContext(org.apache.camel.CamelContext) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) ConnectionFactoryResource(org.apache.camel.component.sjms.jms.ConnectionFactoryResource)

Aggregations

SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)23 CamelContext (org.apache.camel.CamelContext)18 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)16 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)7 ConnectionFactory (javax.jms.ConnectionFactory)3 ConnectionFactoryResource (org.apache.camel.component.sjms.jms.ConnectionFactoryResource)3 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)3 MyAsyncComponent (org.apache.camel.component.sjms.support.MyAsyncComponent)2 Test (org.junit.Test)2 File (java.io.File)1 URISyntaxException (java.net.URISyntaxException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Produces (javax.enterprise.inject.Produces)1 Named (javax.inject.Named)1 ActiveMQConnectionFactory (org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1