Search in sources :

Example 1 with DivertConfigurationRoutingType

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

the class FileConfigurationParser method parseDivertConfiguration.

private void parseDivertConfiguration(final Element e, final Configuration mainConfig) {
    String name = e.getAttribute("name");
    String routingName = getString(e, "routing-name", null, Validators.NO_CHECK);
    String address = getString(e, "address", null, Validators.NOT_NULL_OR_EMPTY);
    String forwardingAddress = getString(e, "forwarding-address", null, Validators.NOT_NULL_OR_EMPTY);
    boolean exclusive = getBoolean(e, "exclusive", ActiveMQDefaultConfiguration.isDefaultDivertExclusive());
    String transformerClassName = getString(e, "transformer-class-name", null, Validators.NO_CHECK);
    DivertConfigurationRoutingType routingType = DivertConfigurationRoutingType.valueOf(getString(e, "routing-type", ActiveMQDefaultConfiguration.getDefaultDivertRoutingType(), Validators.DIVERT_ROUTING_TYPE));
    TransformerConfiguration transformerConfiguration = null;
    String filterString = null;
    NodeList children = e.getChildNodes();
    for (int j = 0; j < children.getLength(); j++) {
        Node child = children.item(j);
        if (child.getNodeName().equals("filter")) {
            filterString = getAttributeValue(child, "string");
        } else if (child.getNodeName().equals("transformer")) {
            transformerConfiguration = getTransformerConfiguration(child);
        }
    }
    if (transformerConfiguration == null && transformerClassName != null) {
        transformerConfiguration = getTransformerConfiguration(transformerClassName);
    }
    DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setRoutingType(routingType);
    mainConfig.getDivertConfigurations().add(config);
}
Also used : TransformerConfiguration(org.apache.activemq.artemis.core.config.TransformerConfiguration) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DivertConfigurationRoutingType(org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType)

Aggregations

SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)1 TransformerConfiguration (org.apache.activemq.artemis.core.config.TransformerConfiguration)1 DivertConfigurationRoutingType (org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1