Search in sources :

Example 31 with DivertConfiguration

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);
}
Also used : DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) Before(org.junit.Before)

Example 32 with DivertConfiguration

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;
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration)

Example 33 with DivertConfiguration

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());
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ServiceName(org.jboss.msc.service.ServiceName) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) ServiceRegistry(org.jboss.msc.service.ServiceRegistry)

Aggregations

DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)33 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)21 Configuration (org.apache.activemq.artemis.core.config.Configuration)19 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)18 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)18 Test (org.junit.Test)18 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)17 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)17 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)17 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)17 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)16 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)4 TransformerConfiguration (org.apache.activemq.artemis.core.config.TransformerConfiguration)4 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)2 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)2 Before (org.junit.Before)2 PrintStream (java.io.PrintStream)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1