this.gateways = gateways;
}
private void configureGateways() {
for (GatewayProxy gateway : gateways) {
Gateway gw = gatewayHub.addGateway(
gateway.getId(),
gateway.getConcurrencyLevel() == null ? Gateway.DEFAULT_CONCURRENCY_LEVEL : gateway
.getConcurrencyLevel());
if (!CollectionUtils.isEmpty(gateway.getEndpoints())) {
for (GatewayProxy.GatewayEndpoint endpoint : gateway.getEndpoints()) {
gw.addEndpoint(endpoint.getId(), endpoint.getHost(), endpoint.getPort());
}
}
if (!CollectionUtils.isEmpty(gateway.getListeners())) {
for (GatewayEventListener listener : gateway.getListeners()) {
gw.addListener(listener);
}
}
if (gateway.getOrderPolicy() != null) {
Assert.isTrue(validOrderPolicyValues.contains(gateway.getOrderPolicy()),
"The value of order policy:'" + gateway.getOrderPolicy() + "' is invalid");
gw.setOrderPolicy(OrderPolicy.valueOf(gateway.getOrderPolicy()));
}
if (gateway.getSocketBufferSize() != null) {
gw.setSocketBufferSize(gateway.getSocketBufferSize());
}
if (gateway.getQueue() != null) {
GatewayQueue queue = gateway.getQueue();
GatewayQueueAttributes queueAttributes = gw.getQueueAttributes();
if (queue.getAlertThreshold() != null) {
queueAttributes.setAlertThreshold(queue.getAlertThreshold());
}
if (queue.getEnableBatchConflation() != null) {
queueAttributes.setBatchConflation(queue.getEnableBatchConflation());