Search in sources :

Example 11 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class AggregratedJmsRouteTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    camelContext.addComponent("jms", jmsComponentAutoAcknowledge(connectionFactory));
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Example 12 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class CamelJmsTestHelper method createPooledConnectionFactory.

public static PooledConnectionFactory createPooledConnectionFactory() {
    ConnectionFactory cf = createConnectionFactory(null, null);
    PooledConnectionFactory pooled = new PooledConnectionFactory();
    pooled.setConnectionFactory(cf);
    pooled.setMaxConnections(8);
    return pooled;
}
Also used : PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) ConnectionFactory(javax.jms.ConnectionFactory) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory)

Example 13 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class ConsumeJmsBytesMessageTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    jmsTemplate = new JmsTemplate(connectionFactory);
    camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory) JmsTemplate(org.springframework.jms.core.JmsTemplate)

Example 14 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsEndpointConfigurationTest method testSetConnectionFactoryAndUsernameAndPassword.

@Test
public void testSetConnectionFactoryAndUsernameAndPassword() throws Exception {
    JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:topic:Foo.Bar?connectionFactory=#myConnectionFactory&username=James&password=ABC", JmsEndpoint.class);
    ConnectionFactory cf = endpoint.getConfiguration().getConnectionFactory();
    assertNotNull("The connectionFactory should not be null", cf);
    assertTrue("The connectionFactory should be the instance of UserCredentialsConnectionFactoryAdapter", cf instanceof UserCredentialsConnectionFactoryAdapter);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) ConnectionFactory(javax.jms.ConnectionFactory) UserCredentialsConnectionFactoryAdapter(org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter) Test(org.junit.Test)

Example 15 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsErrorHandlerLogStackTraceTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent jms = JmsComponent.jmsComponentAutoAcknowledge(connectionFactory);
    jms.setErrorHandlerLogStackTrace(false);
    jms.setErrorHandlerLoggingLevel(LoggingLevel.ERROR);
    camelContext.addComponent("jms", jms);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Aggregations

ConnectionFactory (javax.jms.ConnectionFactory)336 CamelContext (org.apache.camel.CamelContext)204 Test (org.junit.Test)48 Connection (javax.jms.Connection)46 JMSException (javax.jms.JMSException)43 QueueConnectionFactory (javax.jms.QueueConnectionFactory)36 TopicConnectionFactory (javax.jms.TopicConnectionFactory)36 Session (javax.jms.Session)31 JmsComponent (org.apache.camel.component.jms.JmsComponent)24 InitialContext (javax.naming.InitialContext)19 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)19 TestFailureException (org.apache.openejb.test.TestFailureException)19 EJBException (javax.ejb.EJBException)18 Message (javax.jms.Message)16 JndiContext (org.apache.camel.util.jndi.JndiContext)16 Destination (javax.jms.Destination)15 AssertionFailedError (junit.framework.AssertionFailedError)15 MessageConsumer (javax.jms.MessageConsumer)14 MessageProducer (javax.jms.MessageProducer)12 JmsTemplate (org.springframework.jms.core.JmsTemplate)12