This commit is contained in:
Clebert Suconic 2020-05-21 16:27:54 -04:00
commit 0106e26036
4 changed files with 14 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public interface ServiceRegistry {
void addDivertTransformer(String name, Transformer transformer);
void removeDivertTransformer(String name);
/**
* Get an instance of org.apache.activemq.artemis.core.server.transformer.Transformer for a bridge
*

View File

@ -2595,6 +2595,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
postOffice.removeBinding(name, null, true);
if (((DivertBinding)binding).getDivert().getTransformer() != null) {
getServiceRegistry().removeDivertTransformer(name.toString());
}
}
@Override

View File

@ -156,6 +156,11 @@ public class ServiceRegistryImpl implements ServiceRegistry {
divertTransformers.put(name, transformer);
}
@Override
public void removeDivertTransformer(String name) {
divertTransformers.remove(name);
}
@Override
public Transformer getDivertTransformer(String name, TransformerConfiguration transformerConfiguration) {
Transformer transformer = divertTransformers.get(name);

View File

@ -1461,5 +1461,8 @@ public class DivertTest extends ActiveMQTestBase {
}
assertNotNull(divert);
assertEquals(transformer, divert.getTransformer());
server.destroyDivert(SimpleString.toSimpleString(DIVERT));
assertNull(serviceRegistry.getDivertTransformer(DIVERT, null));
}
}