Search in sources :

Example 1 with ServiceRegistryImpl

use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.

the class DivertTest method testInjectedTransformer.

@Test
public void testInjectedTransformer() throws Exception {
    final SimpleString ADDRESS = new SimpleString("myAddress");
    final String DIVERT = "myDivert";
    ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl();
    Transformer transformer = new Transformer() {

        @Override
        public Message transform(Message message) {
            return null;
        }
    };
    serviceRegistry.addDivertTransformer(DIVERT, transformer);
    ActiveMQServer server = addServer(new ActiveMQServerImpl(null, null, null, null, serviceRegistry));
    server.start();
    server.waitForActivation(100, TimeUnit.MILLISECONDS);
    server.createQueue(ADDRESS, RoutingType.MULTICAST, SimpleString.toSimpleString("myQueue"), null, false, false);
    server.deployDivert(new DivertConfiguration().setName(DIVERT).setAddress(ADDRESS.toString()).setForwardingAddress(ADDRESS.toString()));
    Collection<Binding> bindings = server.getPostOffice().getBindingsForAddress(ADDRESS).getBindings();
    Divert divert = null;
    for (Binding binding : bindings) {
        if (binding instanceof DivertBinding) {
            divert = ((DivertBinding) binding).getDivert();
        }
    }
    assertNotNull(divert);
    assertEquals(transformer, divert.getTransformer());
}
Also used : Binding(org.apache.activemq.artemis.core.postoffice.Binding) DivertBinding(org.apache.activemq.artemis.core.postoffice.impl.DivertBinding) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ServiceRegistryImpl(org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl) Transformer(org.apache.activemq.artemis.core.server.transformer.Transformer) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) Message(org.apache.activemq.artemis.api.core.Message) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DivertBinding(org.apache.activemq.artemis.core.postoffice.impl.DivertBinding) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) Divert(org.apache.activemq.artemis.core.server.Divert) Test(org.junit.Test)

Example 2 with ServiceRegistryImpl

use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.

the class RemotingServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    serviceRegistry = new ServiceRegistryImpl();
    configuration = new ConfigurationImpl();
    configuration.setAcceptorConfigurations(new HashSet<TransportConfiguration>());
    remotingService = new RemotingServiceImpl(null, configuration, null, null, null, null, null, serviceRegistry);
}
Also used : RemotingServiceImpl(org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl) ServiceRegistryImpl(org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) Before(org.junit.Before)

Example 3 with ServiceRegistryImpl

use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.

the class ConnectorsServiceTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    // Setup Configuration
    configuration = new ConfigurationImpl();
    serviceRegistry = new ServiceRegistryImpl();
}
Also used : ServiceRegistryImpl(org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) Before(org.junit.Before)

Example 4 with ServiceRegistryImpl

use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.

the class SuppliedThreadPoolTest method setup.

@Before
public void setup() throws Exception {
    serviceRegistry = new ServiceRegistryImpl();
    serviceRegistry.setExecutorService(Executors.newFixedThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory()));
    serviceRegistry.setIOExecutorService(Executors.newFixedThreadPool(5, ActiveMQThreadFactory.defaultThreadFactory()));
    serviceRegistry.setScheduledExecutorService(Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory()));
    server = new ActiveMQServerImpl(null, null, null, null, serviceRegistry);
    server.start();
    server.waitForActivation(100, TimeUnit.MILLISECONDS);
}
Also used : ServiceRegistryImpl(org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) Before(org.junit.Before)

Example 5 with ServiceRegistryImpl

use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.

the class BridgeTest method testInjectedTransformer.

@Test
public void testInjectedTransformer() throws Exception {
    final SimpleString ADDRESS = new SimpleString("myAddress");
    final SimpleString QUEUE = new SimpleString("myQueue");
    final String BRIDGE = "myBridge";
    ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl();
    Transformer transformer = new Transformer() {

        @Override
        public Message transform(Message message) {
            return null;
        }
    };
    serviceRegistry.addBridgeTransformer(BRIDGE, transformer);
    Configuration config = createDefaultInVMConfig().addConnectorConfiguration("in-vm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
    ActiveMQServer server = addServer(new ActiveMQServerImpl(config, null, null, null, serviceRegistry));
    server.start();
    server.waitForActivation(100, TimeUnit.MILLISECONDS);
    server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE, null, false, false);
    List<String> connectors = new ArrayList<>();
    connectors.add("in-vm");
    server.deployBridge(new BridgeConfiguration().setName(BRIDGE).setQueueName(QUEUE.toString()).setForwardingAddress(ADDRESS.toString()).setStaticConnectors(connectors));
    Bridge bridge = server.getClusterManager().getBridges().get(BRIDGE);
    assertNotNull(bridge);
    assertEquals(transformer, ((BridgeImpl) bridge).getTransformer());
}
Also used : ServiceRegistryImpl(org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl) AddHeadersTransformer(org.apache.activemq.artemis.core.server.transformer.AddHeadersTransformer) Transformer(org.apache.activemq.artemis.core.server.transformer.Transformer) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) SessionSendMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage) SessionSendContinuationMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendContinuationMessage) SessionSendLargeMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendLargeMessage) Message(org.apache.activemq.artemis.api.core.Message) TransformerConfiguration(org.apache.activemq.artemis.core.config.TransformerConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) BridgeConfiguration(org.apache.activemq.artemis.core.config.BridgeConfiguration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) ArrayList(java.util.ArrayList) BridgeConfiguration(org.apache.activemq.artemis.core.config.BridgeConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) Bridge(org.apache.activemq.artemis.core.server.cluster.Bridge) Test(org.junit.Test)

Aggregations

ServiceRegistryImpl (org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl)5 ActiveMQServerImpl (org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)3 Before (org.junit.Before)3 Message (org.apache.activemq.artemis.api.core.Message)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)2 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)2 ConfigurationImpl (org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)2 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)2 Transformer (org.apache.activemq.artemis.core.server.transformer.Transformer)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 BridgeConfiguration (org.apache.activemq.artemis.core.config.BridgeConfiguration)1 Configuration (org.apache.activemq.artemis.core.config.Configuration)1 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)1 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)1 TransformerConfiguration (org.apache.activemq.artemis.core.config.TransformerConfiguration)1 Binding (org.apache.activemq.artemis.core.postoffice.Binding)1 DivertBinding (org.apache.activemq.artemis.core.postoffice.impl.DivertBinding)1 SessionSendContinuationMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendContinuationMessage)1