Search in sources :

Example 36 with ActiveMQConnectionFactory

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

the class IgniteJmsStreamerTest method beforeTest.

/**
     * @throws Exception If failed.
     */
@Before
@SuppressWarnings("unchecked")
public void beforeTest() throws Exception {
    grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
    broker = new BrokerService();
    broker.setDeleteAllMessagesOnStartup(true);
    broker.setPersistent(false);
    broker.setPersistenceAdapter(null);
    broker.setPersistenceFactory(null);
    PolicyMap plcMap = new PolicyMap();
    PolicyEntry plc = new PolicyEntry();
    plc.setQueuePrefetch(1);
    broker.setDestinationPolicy(plcMap);
    broker.getDestinationPolicy().setDefaultEntry(plc);
    broker.setSchedulerSupport(false);
    broker.start(true);
    connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI());
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) Before(org.junit.Before)

Example 37 with ActiveMQConnectionFactory

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

the class JmsTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // create a transaction manager
    final GeronimoTransactionManager transactionManager = new GeronimoTransactionManager();
    // create the ActiveMQ resource adapter instance
    ra = new ActiveMQResourceAdapter();
    // initialize properties
    ra.setServerUrl(brokerAddress);
    ra.setBrokerXmlConfig(brokerXmlConfig);
    ra.setStartupTimeout(new Duration(10, TimeUnit.SECONDS));
    // create a thead pool for ActiveMQ
    final Executor threadPool = Executors.newFixedThreadPool(30);
    // create a work manager which ActiveMQ uses to dispatch message delivery jobs
    final TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
    final GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
    // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
    final BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
    // Create a ConnectionFactory
    connectionFactory = new ActiveMQConnectionFactory(brokerAddress);
    ra.setConnectionFactory(connectionFactory);
    // start the resource adapter
    try {
        ra.start(bootstrapContext);
    } catch (final ResourceAdapterInternalException e) {
        throw new OpenEJBException(e);
    }
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) OpenEJBException(org.apache.openejb.OpenEJBException) Executor(java.util.concurrent.Executor) GeronimoBootstrapContext(org.apache.geronimo.connector.GeronimoBootstrapContext) TransactionContextHandler(org.apache.geronimo.connector.work.TransactionContextHandler) GeronimoWorkManager(org.apache.geronimo.connector.work.GeronimoWorkManager) ActiveMQResourceAdapter(org.apache.openejb.resource.activemq.ActiveMQResourceAdapter) Duration(org.apache.openejb.util.Duration) GeronimoBootstrapContext(org.apache.geronimo.connector.GeronimoBootstrapContext) BootstrapContext(javax.resource.spi.BootstrapContext) GeronimoTransactionManager(org.apache.geronimo.transaction.manager.GeronimoTransactionManager) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException)

Example 38 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project ddf by codice.

the class OpenwireProducerConsumerExample method createConnectionFactory.

private ConnectionFactory createConnectionFactory() {
    ActiveMQConnectionFactory jmsConnectFactory = new ActiveMQConnectionFactory();
    jmsConnectFactory.setUserName("admin");
    jmsConnectFactory.setPassword("admin");
    jmsConnectFactory.setBrokerURL("failover://(tcp://localhost:61616,tcp://localhost:61617)");
    jmsConnectFactory.setWatchTopicAdvisories(false);
    return jmsConnectFactory;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory)

Example 39 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project av-service by dvoraka.

the class JmsFileCommonConfig method activeMQConnFactory.

@Bean
public ActiveMQConnectionFactory activeMQConnFactory() {
    ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl);
    factory.setUseAsyncSend(true);
    return factory;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) Bean(org.springframework.context.annotation.Bean)

Example 40 with ActiveMQConnectionFactory

use of org.apache.activemq.ActiveMQConnectionFactory in project av-service by dvoraka.

the class JmsCommonServerConfig method serverActiveMQConnectionFactory.

@Bean
public ActiveMQConnectionFactory serverActiveMQConnectionFactory() {
    ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl);
    factory.setUseAsyncSend(true);
    return factory;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) Bean(org.springframework.context.annotation.Bean)

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