private static InnerNodeVector<Hop> createVector(List<Builder> builders) { List<Hop> elems = new ArrayList<>(); for (Builder b : builders) { elems.add(new Hop(b)); } return new InnerNodeVector<Hop>(elems); } }
private Routingtable(Builder builder, boolean throwIfUninitialized) { if (throwIfUninitialized && ! builder.__uninitialized.isEmpty()) throw new IllegalArgumentException("The following builder parameters for " + "messagebus.routingtable[] must be initialized: " + builder.__uninitialized); protocol = (builder.protocol == null) ? new StringNode() : new StringNode(builder.protocol); hop = Hop.createVector(builder.hop); route = Route.createVector(builder.route); }
@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); }
public Hop build() { return new Hop(this); }
public Builder(Hop config) { name(config.name()); selector(config.selector()); recipient(config.recipient()); ignoreresult(config.ignoreresult()); }