use of org.apache.activemq.artemis.core.config.DivertConfiguration in project activemq-artemis by apache.
the class ReplicationWithDivertTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
System.out.println("Tmp::" + getTemporaryDir());
flagChunkEntered.setCount(1);
flagChunkWait.setCount(1);
flagSyncEntered.setCount(1);
flagSyncWait.setCount(1);
messageChunkCount = 0;
TransportConfiguration liveConnector = TransportConfigurationUtils.getNettyConnector(true, 0);
TransportConfiguration liveAcceptor = TransportConfigurationUtils.getNettyAcceptor(true, 0);
TransportConfiguration backupConnector = TransportConfigurationUtils.getNettyConnector(false, 0);
TransportConfiguration backupAcceptor = TransportConfigurationUtils.getNettyAcceptor(false, 0);
backupConfig = createDefaultInVMConfig().setBindingsDirectory(getBindingsDir(0, true)).setJournalDirectory(getJournalDir(0, true)).setPagingDirectory(getPageDir(0, true)).setLargeMessagesDirectory(getLargeMessagesDir(0, true));
backupConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(SOURCE_QUEUE).setName(SOURCE_QUEUE).setRoutingType(RoutingType.ANYCAST));
backupConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE).setRoutingType(RoutingType.ANYCAST));
DivertConfiguration divertConfiguration = new DivertConfiguration().setName("Test").setAddress(SOURCE_QUEUE).setForwardingAddress(TARGET_QUEUE).setRoutingName("Test");
liveConfig = createDefaultInVMConfig();
liveConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(SOURCE_QUEUE).setName(SOURCE_QUEUE).setDurable(true).setRoutingType(RoutingType.ANYCAST));
liveConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE).setDurable(true).setRoutingType(RoutingType.ANYCAST));
liveConfig.addDivertConfiguration(divertConfiguration);
backupConfig.addDivertConfiguration(divertConfiguration);
ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector, liveAcceptor);
liveServer = createServer(liveConfig);
liveServer.start();
startBackup();
waitForServerToStart(liveServer);
// Just to make sure the expression worked
Assert.assertEquals(10000, factory.getMinLargeMessageSize());
Assert.assertEquals(10000, factory.getProducerWindowSize());
Assert.assertEquals(100, factory.getRetryInterval());
Assert.assertEquals(-1, factory.getReconnectAttempts());
Assert.assertTrue(factory.isHA());
connection = (ActiveMQConnection) factory.createConnection();
session = connection.createSession(true, Session.SESSION_TRANSACTED);
queue = session.createQueue(JMS_SOURCE_QUEUE);
targetQueue = session.createQueue(JMS_TARGET_QUEUE);
producer = session.createProducer(queue);
}
use of org.apache.activemq.artemis.core.config.DivertConfiguration in project activemq-artemis by apache.
the class DivertAndACKClientTest method createDefaultConfig.
@Override
protected Configuration createDefaultConfig(final boolean netty) throws Exception {
DivertConfiguration divert = new DivertConfiguration().setName("local-divert").setRoutingName("some-name").setAddress("Source").setForwardingAddress("Dest").setExclusive(true);
Configuration config = super.createDefaultConfig(netty).addDivertConfiguration(divert);
return config;
}
use of org.apache.activemq.artemis.core.config.DivertConfiguration in project wildfly by wildfly.
the class DivertRemove method recoverServices.
@Override
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
final ServiceController<?> service = registry.getService(serviceName);
if (service != null && service.getState() == ServiceController.State.UP) {
final String name = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
final DivertConfiguration divertConfiguration = DivertAdd.createDivertConfiguration(context, name, model);
ActiveMQServer server = ActiveMQServer.class.cast(service.getValue());
DivertAdd.createDivert(name, divertConfiguration, server.getActiveMQServerControl());
}
}
Aggregations