You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by 唐 思成 <ja...@qq.com> on 2014/07/12 16:33:27 UTC

how to run a trident topology with a local drpc

   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"))

Re: Re: how to run a trident topology with a local drpc

Posted by 唐思成 <ja...@qq.com>.
thx, I will try 


2014-07-16 



唐思成 



发件人: David DIDIER 
发送时间: 2014-07-16  17:15:32 
收件人: user 
抄送: 
主题: Re: how to run a trident topology with a local drpc 
 
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 唐 思成 <ja...@qq.com>:

   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"))

Re: how to run a trident topology with a local drpc

Posted by David DIDIER <ci...@gmail.com>.
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 唐 思成 <ja...@qq.com>:

>    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"))