private boolean lookupRoute() {
        RoutingTable table = mbus.getRoutingTable(msg.getProtocol());
        Hop hop = route.getHop(0);
        if (hop.getDirective(0) instanceof RouteDirective dir) {
            if (table == null || !table.hasRoute(dir.getName())) {
                setError(ErrorCode.ILLEGAL_ROUTE, "Route '" + dir.getName() + "' does not exist.");
                return false;
            }
            insertRoute(table.getRoute(dir.getName()));
            if (trace.shouldTrace(TraceLevel.SPLIT_MERGE)) {
                trace.trace(TraceLevel.SPLIT_MERGE,
                            "Route '" + dir.getName() + "' retrieved by directive; new route is '" + route + "'.");
            }
            return true;
        }
        if (table != null) {
            String name = hop.getServiceName();
            if (table.hasRoute(name)) {
                insertRoute(table.getRoute(name));
                if (trace.shouldTrace(TraceLevel.SPLIT_MERGE)) {
                    trace.trace(TraceLevel.SPLIT_MERGE, "Recognized '" + name + "' as route '" + route + "'.");
                }
                return true;
            }
        }
        return false;
    }
This method checks to see whether the current hop contains a {@link RouteDirective}, or if its string
representation is actually the name of a configured route. If a route is found, the first hop of the current
route is replaced by expanding the named route. If a route directive requests a non-existant route, this method
creates an error-reply for this node.

@return True if a route was found and added.
@see #insertRoute(Route)
messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java