I've had the same problem. Here's how I solved it:
ILocalDRPC drpcServer = new LocalDRPC();
TridentTopology topology = new TridentTopology();
TridentState wordCounts = ...
topology.newDRPCStream("words", drpcServer)...
<start topology>
<kill topology>
drpcServer.shutdown();
2014-07-12 16:33 GMT+02:00 唐 思成 <[email protected]>:
> I tired to build a trident topology as the official trident tutorial
> told
> http://storm.incubator.apache.org/documentation/Trident-tutorial.html
>
> the code is simple, but I don’t have a cluster so I wanna run this
> topology with local cluster with a local drpc, but I don’t know how, any
> idea?
>
> my code is here---------------
> TridentTopology topology;
> topology = new TridentTopology();
>
> TridentState wordCounts = topology.newStream("spout1", spout)
> .each(new Fields("sentence"), new Split(), new
> Fields("word"))
> .groupBy(new Fields("word"))
> .persistentAggregate(new MemoryMapState.Factory(), new
> Count(), new Fields("count"))
> .parallelismHint(10);
>
> topology.newDRPCStream("words")
> .each(new Fields("args"), new Split(), new Fields("word"))
> .groupBy(new Fields("word"))
> .stateQuery(wordCounts, new Fields("word"), new MapGet(),
> new Fields("count"))
> .each(new Fields("count"), new FilterNull())
> .aggregate(new Fields("count"), new Sum(), new
> Fields("sum"))