use of org.apache.camel.component.sjms.jms.ConnectionFactoryResource in project camel by apache.
the class TransactedTopicProducerTest 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");
ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
connectionResource.setConnectionFactory(connectionFactory);
connectionResource.setClientId("test-connection-1");
CamelContext camelContext = super.createCamelContext();
SjmsComponent component = new SjmsComponent();
component.setConnectionResource(connectionResource);
component.setConnectionCount(1);
camelContext.addComponent("sjms", component);
return camelContext;
}
use of org.apache.camel.component.sjms.jms.ConnectionFactoryResource 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;
}
use of org.apache.camel.component.sjms.jms.ConnectionFactoryResource in project camel by apache.
the class SjmsEndpoint method createConnectionResource.
protected ConnectionResource createConnectionResource(Object source) {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException(String.format("ConnectionResource or ConnectionFactory must be configured for %s", this));
}
try {
logger.debug("Creating ConnectionResource with connectionCount: {} using ConnectionFactory", getConnectionCount(), getConnectionFactory());
// We always use a connection pool, even for a pool of 1
ConnectionFactoryResource connections = new ConnectionFactoryResource(getConnectionCount(), getConnectionFactory(), getComponent().getConnectionUsername(), getComponent().getConnectionPassword(), getComponent().getConnectionClientId(), getComponent().getConnectionMaxWait(), getComponent().isConnectionTestOnBorrow());
if (exceptionListener != null) {
connections.setExceptionListener(exceptionListener);
} else {
// add a exception listener that logs so we can see any errors that happens
ExceptionListener listener = new SjmsLoggingExceptionListener(new LoggingExceptionHandler(getCamelContext(), source.getClass()), isErrorHandlerLogStackTrace());
connections.setExceptionListener(listener);
}
connections.fillPool();
return connections;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
use of org.apache.camel.component.sjms.jms.ConnectionFactoryResource 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();
Sjms2Component component = new Sjms2Component();
component.setConnectionResource(connectionResource);
component.setConnectionCount(1);
camelContext.addComponent("sjms2", component);
return camelContext;
}
use of org.apache.camel.component.sjms.jms.ConnectionFactoryResource in project ddf by codice.
the class CoreProducerConsumerExample method createCamelContext.
private void createCamelContext() throws Exception {
CamelContext camelContext = getContext();
ActiveMQConnectionFactory factory = ActiveMQJMSClient.createConnectionFactory("(tcp://0.0.0.0:5672,tcp://0.0.0.0:61617)?ha=true;sslEnabled=true;enabledCipherSuites=TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256;enabledProtocols=TLSv1.1,TLSv1.2", "name");
factory.setRetryInterval(1000);
factory.setRetryIntervalMultiplier(1.0);
factory.setReconnectAttempts(-1);
SjmsComponent sjms = new SjmsComponent();
ConnectionFactoryResource connectionResource = new ConnectionFactoryResource(1, factory, "admin", "admin");
sjms.setConnectionResource(connectionResource);
camelContext.addComponent("sjms", sjms);
}
Aggregations