265.4.2. ステップ 2: Dispatch マップの代わりに Dispatch ストラテジーを使用したオプションで
ディスパッチストラテジーを使用するには、以下の例のように org.apache.camel.component.routebox.strategy.RouteboxDispatchStrategy インターフェースを実装します。
public class SimpleRouteDispatchStrategy implements RouteboxDispatchStrategy { /* (non-Javadoc) * @see org.apache.camel.component.routebox.strategy.RouteboxDispatchStrategy#selectDestinationUri(java.util.List, org.apache.camel.Exchange) */ public URI selectDestinationUri(List<URI> activeDestinations, Exchange exchange) { URI dispatchDestination = null; String operation = exchange.getIn().getHeader("ROUTE_DISPATCH_KEY", String.class); for (URI destination : activeDestinations) { if (destination.toASCIIString().equalsIgnoreCase("seda:" + operation)) { dispatchDestination = destination; break; } } return dispatchDestination; } }