use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class FailoverJmsProducerCase method testConnectionEquals.
@Test
public void testConnectionEquals() throws Exception {
FailoverJmsConnection connection = new FailoverJmsConnection();
connection.addConnection(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true));
connection.addConnection(activeMqBroker.getJmsConnection());
assertEquals(false, connection.connectionEquals(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:123456"))));
try {
LifecycleHelper.initAndStart(connection);
assertNotNull(connection.currentJmsConnection());
assertEquals(true, connection.connectionEquals(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true)));
} finally {
LifecycleHelper.stopAndClose(connection);
}
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class FailoverJmsProducerCase method testEventuallyConnects.
@Test
public void testEventuallyConnects() throws Exception {
FailoverJmsConnection connection = new FailoverJmsConnection();
connection.addConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:123456")));
connection.addConnection(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true));
connection.setConnectionRetryInterval(new TimeInterval(250L, TimeUnit.MILLISECONDS));
connection.addExceptionListener(new StandaloneConsumer());
connection.setRegisterOwner(true);
ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
try {
es.schedule(new Runnable() {
@Override
public void run() {
try {
activeMqBroker.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}, 2L, TimeUnit.SECONDS);
LifecycleHelper.initAndStart(connection);
} finally {
LifecycleHelper.stopAndClose(connection);
es.shutdownNow();
}
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class FailoverPtpProducerTest method createFailoverConfigExample.
static FailoverJmsConnection createFailoverConfigExample(boolean isPtp) {
FailoverJmsConnection result = null;
result = new FailoverJmsConnection(new ArrayList<JmsConnection>(Arrays.asList(new JmsConnection[] { new JmsConnection(new BasicActiveMqImplementation("tcp://SomeUnclusteredBroker:9999")), new JmsConnection(new BasicActiveMqImplementation("tcp://SomeUnclusteredBroker:9998")) })));
result.setConnectionErrorHandler(new JmsConnectionErrorHandler());
return result;
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class BasicPtpConsumerActiveErorHandlerTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
JmsConnection p = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616"));
ActiveJmsConnectionErrorHandler erHandler = new ActiveJmsConnectionErrorHandler();
erHandler.setCheckInterval(new TimeInterval(30L, TimeUnit.SECONDS));
p.setConnectionErrorHandler(erHandler);
return new StandaloneConsumer(p, new PtpConsumer().withQueue("TheQueueToConsumeFrom"));
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class PtpConsumerTest method retrieveSampleConfig.
protected StandaloneConsumer retrieveSampleConfig() {
JmsConnection c = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616"));
PtpConsumer pc = new PtpConsumer();
pc.setQueue("destination");
MetadataCorrelationIdSource mcs = new MetadataCorrelationIdSource();
mcs.setMetadataKey("MetadataKey");
pc.setCorrelationIdSource(mcs);
c.setConnectionErrorHandler(new JmsConnectionErrorHandler());
StandaloneConsumer result = new StandaloneConsumer();
result.setConnection(c);
result.setConsumer(pc);
return result;
}
Aggregations