use of org.springframework.integration.routingslip.RoutingSlipRouteStrategy in project spring-integration by spring-projects.
the class RoutingSlipHeaderValueMessageProcessor method processMessage.
@Override
public Map<List<Object>, Integer> processMessage(Message<?> message) {
// use a local variable to avoid the second access to volatile field on the happy path
Map<List<Object>, Integer> routingSlip = this.routingSlip;
if (routingSlip == null) {
synchronized (this) {
routingSlip = this.routingSlip;
if (routingSlip == null) {
List<Object> routingSlipPath = this.routingSlipPath;
List<Object> routingSlipValues = new ArrayList<Object>(routingSlipPath.size());
for (Object path : routingSlipPath) {
if (path instanceof String) {
String entry = (String) path;
if (this.beanFactory.containsBean(entry)) {
Object bean = this.beanFactory.getBean(entry);
if (!(bean instanceof MessageChannel || bean instanceof RoutingSlipRouteStrategy)) {
throw new IllegalArgumentException("The RoutingSlip can contain " + "only bean names of MessageChannel or RoutingSlipRouteStrategy: " + bean);
}
routingSlipValues.add(entry);
} else {
ExpressionEvaluatingRoutingSlipRouteStrategy strategy = new ExpressionEvaluatingRoutingSlipRouteStrategy(entry);
strategy.setBeanFactory(this.beanFactory);
try {
strategy.afterPropertiesSet();
} catch (Exception e) {
throw new IllegalStateException(e);
}
routingSlipValues.add(strategy);
}
} else {
routingSlipValues.add(path);
}
}
routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0);
this.routingSlip = routingSlip;
}
}
}
return routingSlip;
}
Aggregations