Search in sources :

Example 1 with RoutingSpec

use of com.yahoo.messagebus.routing.RoutingSpec in project vespa by vespa-engine.

the class ConfigAgent method configure.

@Override
public void configure(MessagebusConfig config) {
    RoutingSpec routing = new RoutingSpec();
    for (int table = 0; table < config.routingtable().size(); table++) {
        MessagebusConfig.Routingtable tableConfig = config.routingtable(table);
        RoutingTableSpec tableSpec = new RoutingTableSpec(tableConfig.protocol());
        for (int hop = 0; hop < tableConfig.hop().size(); hop++) {
            MessagebusConfig.Routingtable.Hop hopConfig = tableConfig.hop(hop);
            HopSpec hopSpec = new HopSpec(hopConfig.name(), hopConfig.selector());
            for (int recipient = 0; recipient < hopConfig.recipient().size(); recipient++) {
                hopSpec.addRecipient(hopConfig.recipient(recipient));
            }
            hopSpec.setIgnoreResult(hopConfig.ignoreresult());
            tableSpec.addHop(hopSpec);
        }
        for (int route = 0; route < tableConfig.route().size(); route++) {
            MessagebusConfig.Routingtable.Route routeConfig = tableConfig.route(route);
            RouteSpec routeSpec = new RouteSpec(routeConfig.name());
            for (int hop = 0; hop < routeConfig.hop().size(); hop++) {
                routeSpec.addHop(routeConfig.hop(hop));
            }
            tableSpec.addRoute(routeSpec);
        }
        routing.addTable(tableSpec);
    }
    handler.setupRouting(routing);
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) MessagebusConfig(com.yahoo.messagebus.MessagebusConfig) HopSpec(com.yahoo.messagebus.routing.HopSpec) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) RoutingSpec(com.yahoo.messagebus.routing.RoutingSpec)

Aggregations

MessagebusConfig (com.yahoo.messagebus.MessagebusConfig)1 HopSpec (com.yahoo.messagebus.routing.HopSpec)1 RouteSpec (com.yahoo.messagebus.routing.RouteSpec)1 RoutingSpec (com.yahoo.messagebus.routing.RoutingSpec)1 RoutingTableSpec (com.yahoo.messagebus.routing.RoutingTableSpec)1