FakeTweetGenerator fakeTweets = new FakeTweetGenerator();
FeederBatchSpout testSpout = new FeederBatchSpout(ImmutableList.of("id", "text", "actor", "location", "date"));
Config conf = new Config();
LocalCluster cluster = new LocalCluster();
LocalDRPC drpc = new LocalDRPC();
cluster.submitTopology("state_drpc", conf, basicStateAndDRPC(drpc, testSpout));
// You can use FeederBatchSpout to feed known values to the topology. Very useful for tests.
testSpout.feed(fakeTweets.getNextTweetTuples("ted"));
testSpout.feed(fakeTweets.getNextTweetTuples("ted"));
testSpout.feed(fakeTweets.getNextTweetTuples("mary"));
testSpout.feed(fakeTweets.getNextTweetTuples("jason"));
// This is how you make DRPC calls. First argument must match the function name
// System.out.println(drpc.execute("ping", "ping pang pong"));
// System.out.println(drpc.execute("count", "america america ace ace ace item"));
System.out.println(drpc.execute("count_per_actor", "ted"));
// System.out.println(drpc.execute("count_per_actors", "ted mary pere jason"));
// You can use a client library to make calls remotely
// DRPCClient client = new DRPCClient("drpc.server.location", 3772);
// System.out.println(client.execute("ping", "ping pang pong"));