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);
}
Aggregations