use of org.apache.activemq.artemis.core.config.TransformerConfiguration in project activemq-artemis by apache.
the class ActiveMQServerControlImpl method createBridge.
@Override
public void createBridge(final String name, final String queueName, final String forwardingAddress, final String filterString, final String transformerClassName, final long retryInterval, final double retryIntervalMultiplier, final int initialConnectAttempts, final int reconnectAttempts, final boolean useDuplicateDetection, final int confirmationWindowSize, final long clientFailureCheckPeriod, final String staticConnectorsOrDiscoveryGroup, boolean useDiscoveryGroup, final boolean ha, final String user, final String password) throws Exception {
checkStarted();
clearIO();
try {
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration(transformerClassName);
BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setClientFailureCheckPeriod(clientFailureCheckPeriod).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setHA(ha).setUser(user).setPassword(password);
if (useDiscoveryGroup) {
config.setDiscoveryGroupName(staticConnectorsOrDiscoveryGroup);
} else {
config.setStaticConnectors(ListUtil.toList(staticConnectorsOrDiscoveryGroup));
}
server.deployBridge(config);
} finally {
blockOnIO();
}
}
use of org.apache.activemq.artemis.core.config.TransformerConfiguration in project activemq-artemis by apache.
the class FileConfigurationParser method parseBridgeConfiguration.
private void parseBridgeConfiguration(final Element brNode, final Configuration mainConfig) throws Exception {
String name = brNode.getAttribute("name");
String queueName = getString(brNode, "queue-name", null, Validators.NOT_NULL_OR_EMPTY);
String forwardingAddress = getString(brNode, "forwarding-address", null, Validators.NO_CHECK);
String transformerClassName = getString(brNode, "transformer-class-name", null, Validators.NO_CHECK);
// Default bridge conf
int confirmationWindowSize = getTextBytesAsIntBytes(brNode, "confirmation-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(), Validators.GT_ZERO);
int producerWindowSize = getTextBytesAsIntBytes(brNode, "producer-window-size", ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(), Validators.GT_ZERO);
long retryInterval = getLong(brNode, "retry-interval", ActiveMQClient.DEFAULT_RETRY_INTERVAL, Validators.GT_ZERO);
long clientFailureCheckPeriod = getLong(brNode, "check-period", ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, Validators.GT_ZERO);
long connectionTTL = getLong(brNode, "connection-ttl", ActiveMQClient.DEFAULT_CONNECTION_TTL, Validators.GT_ZERO);
int minLargeMessageSize = getTextBytesAsIntBytes(brNode, "min-large-message-size", ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, Validators.GT_ZERO);
long maxRetryInterval = getLong(brNode, "max-retry-interval", ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, Validators.GT_ZERO);
double retryIntervalMultiplier = getDouble(brNode, "retry-interval-multiplier", ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, Validators.GT_ZERO);
int initialConnectAttempts = getInteger(brNode, "initial-connect-attempts", ActiveMQDefaultConfiguration.getDefaultBridgeInitialConnectAttempts(), Validators.MINUS_ONE_OR_GE_ZERO);
int reconnectAttempts = getInteger(brNode, "reconnect-attempts", ActiveMQDefaultConfiguration.getDefaultBridgeReconnectAttempts(), Validators.MINUS_ONE_OR_GE_ZERO);
int reconnectAttemptsSameNode = getInteger(brNode, "reconnect-attempts-same-node", ActiveMQDefaultConfiguration.getDefaultBridgeConnectSameNode(), Validators.MINUS_ONE_OR_GE_ZERO);
boolean useDuplicateDetection = getBoolean(brNode, "use-duplicate-detection", ActiveMQDefaultConfiguration.isDefaultBridgeDuplicateDetection());
String user = getString(brNode, "user", ActiveMQDefaultConfiguration.getDefaultClusterUser(), Validators.NO_CHECK);
NodeList clusterPassNodes = brNode.getElementsByTagName("password");
String password = null;
if (clusterPassNodes.getLength() > 0) {
Node passNode = clusterPassNodes.item(0);
password = passNode.getTextContent();
}
if (password != null) {
password = PasswordMaskingUtil.resolveMask(mainConfig.isMaskPassword(), password, mainConfig.getPasswordCodec());
} else {
password = ActiveMQDefaultConfiguration.getDefaultClusterPassword();
}
boolean ha = getBoolean(brNode, "ha", false);
TransformerConfiguration transformerConfiguration = null;
String filterString = null;
List<String> staticConnectorNames = new ArrayList<>();
String discoveryGroupName = null;
NodeList children = brNode.getChildNodes();
for (int j = 0; j < children.getLength(); j++) {
Node child = children.item(j);
if (child.getNodeName().equals("filter")) {
filterString = child.getAttributes().getNamedItem("string").getNodeValue();
} else if (child.getNodeName().equals("discovery-group-ref")) {
discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
} else if (child.getNodeName().equals("static-connectors")) {
getStaticConnectors(staticConnectorNames, child);
} else if (child.getNodeName().equals("transformer")) {
transformerConfiguration = getTransformerConfiguration(child);
}
}
if (transformerConfiguration == null && transformerClassName != null) {
transformerConfiguration = getTransformerConfiguration(transformerClassName);
}
BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setMinLargeMessageSize(minLargeMessageSize).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setRetryInterval(retryInterval).setMaxRetryInterval(maxRetryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setReconnectAttemptsOnSameNode(reconnectAttemptsSameNode).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setHA(ha).setUser(user).setPassword(password);
if (!staticConnectorNames.isEmpty()) {
config.setStaticConnectors(staticConnectorNames);
} else {
config.setDiscoveryGroupName(discoveryGroupName);
}
mainConfig.getBridgeConfigurations().add(config);
}
use of org.apache.activemq.artemis.core.config.TransformerConfiguration in project activemq-artemis by apache.
the class FileConfigurationParser method getTransformerConfiguration.
private TransformerConfiguration getTransformerConfiguration(final Node node) {
Element element = (Element) node;
String className = getString(element, "class-name", null, Validators.NO_CHECK);
Map<String, String> properties = getMapOfChildPropertyElements(element);
return new TransformerConfiguration(className).setProperties(properties);
}
use of org.apache.activemq.artemis.core.config.TransformerConfiguration 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);
}
use of org.apache.activemq.artemis.core.config.TransformerConfiguration in project activemq-artemis by apache.
the class ActiveMQServerControlImpl method createBridge.
@Override
public void createBridge(final String name, final String queueName, final String forwardingAddress, final String filterString, final String transformerClassName, final Map<String, String> transformerProperties, final long retryInterval, final double retryIntervalMultiplier, final int initialConnectAttempts, final int reconnectAttempts, final boolean useDuplicateDetection, final int confirmationWindowSize, final int producerWindowSize, final long clientFailureCheckPeriod, final String staticConnectorsOrDiscoveryGroup, boolean useDiscoveryGroup, final boolean ha, final String user, final String password) throws Exception {
checkStarted();
clearIO();
try {
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration(transformerClassName).setProperties(transformerProperties);
BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setClientFailureCheckPeriod(clientFailureCheckPeriod).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setHA(ha).setUser(user).setPassword(password);
if (useDiscoveryGroup) {
config.setDiscoveryGroupName(staticConnectorsOrDiscoveryGroup);
} else {
config.setStaticConnectors(ListUtil.toList(staticConnectorsOrDiscoveryGroup));
}
server.deployBridge(config);
} finally {
blockOnIO();
}
}
Aggregations