@@ -0,0 +1,2838 @@
+/*%0A* Copyright 2013 the original author or authors.%0A*%0A* Licensed under the Apache License, Version 2.0 (the %22License%22);%0A* you may not use this file except in compliance with the License.%0A* You may obtain a copy of the License at%0A*%0A* http://www.apache.org/licenses/LICENSE-2.0%0A*%0A* Unless required by applicable law or agreed to in writing, software%0A* distributed under the License is distributed on an %22AS IS%22 BASIS,%0A* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A* See the License for the specific language governing permissions and%0A* limitations under the License.%0A*/%0Apackage pool;%0A%0Aimport org.vertx.java.platform.Verticle;%0Aimport org.vertx.java.core.logging.Logger;%0Aimport org.vertx.java.core.Handler;%0Aimport org.vertx.java.core.AsyncResult;%0Aimport org.vertx.java.core.json.JsonObject;%0A%0Aimport com.blankstyle.vine.definition.VineDefinition;%0Aimport com.blankstyle.vine.context.VineContext;%0Aimport com.blankstyle.vine.ReliableSeedVerticle;%0Aimport com.blankstyle.vine.Groupings;%0Aimport com.blankstyle.vine.Root;%0Aimport com.blankstyle.vine.local.LocalRoot;%0Aimport com.blankstyle.vine.feeder.Executor;%0Aimport com.blankstyle.vine.feeder.BasicExecutor;%0A%0A/**%0A * A process pool example.%0A *%0A * This example uses a single seed with multiple worker instances to%0A * perform RPC on a pool of workers.%0A *%0A * @author Jordan Halterman%0A */%0Aclass ProcessPoolVine extends Verticle %7B%0A%0A  public static class ProcessPool extends ReliableSeedVerticle %7B%0A%0A    @Override%0A    public void process(JsonObject data) %7B%0A      emit(new JsonObject().putNumber(%22result%22, data.getInteger(%22first%22) * data.getInteger(%22second%22)));%0A      ack(data);%0A    %7D%0A%0A  %7D%0A%0A  private Logger logger;%0A%0A  @Override%0A  public void start() %7B%0A    logger = container.logger();%0A%0A    VineDefinition vine = new VineDefinition(%22processpool%22);%0A    vine.feed(%22pool%22, ProcessPool.class.getName(), 6).groupBy(Groupings.random());%0A%0A    final Root root = new LocalRoot(vertx, container);%0A    root.deploy(vine, new Handler%3CAsyncResult%3CVineContext%3E%3E() %7B%0A      @Override%0A      public void handle(Handler%3CAsyncResult%3CVineContext%3E%3E result) %7B%0A        if (result.succeeded()) %7B%0A          final VineContext context = result.result();%0A          Executor executor = new BasicExecutor(context, vertx);%0A          executor.execute(new JsonObject().putNumber(%22first%22, 10).putNumber(%22second%22, 100), new Handler%3CAsyncResult%3CJsonObject%3E%3E() %7B%0A            @Override%0A            public void handle(AsyncResult%3CJsonObject%3E result) %7B%0A              if (result.succeeded()) %7B%0A                logger.info(String.format(%2210 * 100 = %25d%22, result.result().getInteger(%22result%22)));%0A              %7D%0A              else %7B%0A                logger.warning(%22Failed to execute vine. %22 + result.cause());%0A              %7D%0A              root.shutdown(context);%0A            %7D%0A          %7D);%0A        %7D%0A      %7D%0A    %7D);%0A  %7D%0A%0A%7D%0A

Add new custom feeder example.