use of org.apache.activemq.artemis.core.server.transformer.Transformer 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());
}
use of org.apache.activemq.artemis.core.server.transformer.Transformer in project activemq-artemis by apache.
the class ServiceRegistryImpl method getBridgeTransformer.
@Override
public Transformer getBridgeTransformer(String name, TransformerConfiguration transformerConfiguration) {
Transformer transformer = bridgeTransformers.get(name);
if (transformer == null && transformerConfiguration != null && transformerConfiguration.getClassName() != null) {
transformer = instantiateTransformer(transformerConfiguration);
addBridgeTransformer(name, transformer);
}
return transformer;
}
Aggregations