/** * <p>Returns a named routing table, may return null.</p> * * @param name The name of the routing table to return. * @return The routing table object. */ public RoutingTable getRoutingTable(Utf8String name) { return getRoutingTable(name.toString()); }
public static MessageBusVisitorSession createForMessageBus(final MessageBus mbus, final ScheduledExecutorService scheduledExecutorService, final VisitorParameters params) throws ParseException { final AsyncTaskExecutor executor = new ThreadAsyncTaskExecutor(scheduledExecutorService); final MessageBusSenderFactory senderFactory = new MessageBusSenderFactory(mbus); final MessageBusReceiverFactory receiverFactory = new MessageBusReceiverFactory(mbus); final RoutingTable table = mbus.getRoutingTable(DocumentProtocol.NAME); return new MessageBusVisitorSession(params, executor, senderFactory, receiverFactory, table); }
/** * This method checks to see whether the string representation of the current hop is actually the name of another. * If a hop is found, the first hop of the current route is replaced by this. * * @return True if a hop was found and added. */ private boolean lookupHop() { RoutingTable table = mbus.getRoutingTable(msg.getProtocol()); if (table != null) { String name = route.getHop(0).getServiceName(); if (table.hasHop(name)) { HopBlueprint hop = table.getHop(name); configureFromBlueprint(hop); if (trace.shouldTrace(TraceLevel.SPLIT_MERGE)) { trace.trace(TraceLevel.SPLIT_MERGE, "Recognized '" + name + "' as " + hop + "."); } return true; } } return false; }
RoutingTable table = mbus.getRoutingTable(msg.getProtocol().toString()); if (table != null) { Route route = table.getRoute(routeName);
@Override public void select(RoutingContext context) { // Require that recipients have been configured. if (context.getNumRecipients() == 0) { context.setError(DocumentProtocol.ERROR_POLICY_FAILURE, "No recipients configured."); return; } // Invoke private select method for each candidate recipient. synchronized (this) { if (error != null) { context.setError(DocumentProtocol.ERROR_POLICY_FAILURE, error); return; } for (int i = 0; i < context.getNumRecipients(); ++i) { Route recipient = context.getRecipient(i); String routeName = recipient.toString(); if (select(context, routeName)) { Route route = context.getMessageBus().getRoutingTable(DocumentProtocol.NAME).getRoute(routeName); context.addChild(route != null ? route : recipient); } } } context.setSelectOnRetry(false); // Notify that no children were selected, this is to differentiate this from the NO_RECIPIENTS_FOR_ROUTE error // that message bus will generate if there are no recipients and no reply. if (context.getNumChildren() == 0) { context.setReply(new DocumentIgnoredReply()); } }
RoutingTable table = mbus.getRoutingTable(msg.getProtocol()); Hop hop = route.getHop(0); if (hop.getDirective(0) instanceof RouteDirective) {