You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Junfeng Chen <k-...@hotmail.com> on 2015/03/16 04:21:59 UTC

答复: Why Trident always emit tuples?

The column name is “Emitted”, “Transferred”, etc, which indicates a statistic value. Are you sure the above data is keeping changing while you refresh the web page?

 

发件人: 张炜 [mailto:zhangweisjz@gmail.com] 
发送时间: 2015年3月16日 11:08
收件人: user@storm.apache.org
主题: Re: Why Trident always emit tuples?

 

Please review the screenshot attached.



On Mon, Mar 16, 2015 at 11:06 AM 张炜 <zhangweisjz@gmail.com <ma...@gmail.com> > wrote:

Dear all,

I found an interesting problem when I use Trident, please kindly help.

Even there is no operation in spout.execute() command, Storm UI still shows that lots of tuples being emitted. Please refer to the Screenshot attached. Also the source code is shown below ( the source codes might not be exact the same as in eclipse because of the format problem, it is to show logic):

 

tpy.newStream("bbb", new BaseRichSpout() {

@Override

public void declareOutputFields(OutputFieldsDeclarer declarer) {

declarer.declare(new Fields("lines"));

}

@Override

public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {

// TODO Auto-generated method stub

}

 

@Override

public void nextTuple() {

// TODO Auto-generated method stub

}

}).each(new Fields("lines"), new Filter() {

 

@Override

public void prepare(Map conf, TridentOperationContext context) {

// TODO Auto-generated method stub

}

 

@Override

public void cleanup() {

// TODO Auto-generated method stub

}

 

@Override

public boolean isKeep(TridentTuple tuple) {

System.out.println(tuple);

return false;

}

});

 

Thank you very much!

 

Regards,

Sai


回复:答复: Why Trident always emit tuples?

Posted by 李国忠 <li...@qq.com>.
大家都是中国人,写汉语啊。你用trident来做,spout的就继承ITransactionalSpout,后面,IPartitionedTridentSpout,IOpaquePartitionedTridentSpout,IBatchSpout,IRichSpout,会进行接口的适配器,来接入ITransactionalSpout,但是你这里用这个IRichSpout,不对,虽然会适配,但是一般都不用rich这个,因为他不是批量的概念,虽然trident很友好的做了接口适配。但是做trident的话,1:ITransactionalSpout,2:IPartitionedTridentSpout,3:IOpaquePartitionedTridentSpout,4:IBatchSpout。这四个spout才是你的选择。先走到主流的spout再看看你的问题还在不在。
‍‍‍‍‍
‍‍

------------------ 原始邮件 ------------------
发件人: "Junfeng Chen";<k-...@hotmail.com>;
发送时间: 2015年3月16日(星期一) 中午11:21
收件人: "user"<us...@storm.apache.org>; 

主题: 答复: Why Trident always emit tuples?




The column name is “Emitted”, “Transferred”, etc, which indicates a statistic value. Are you sure the above data is keeping changing while you refresh the web page?

 

发件人: 张炜 [mailto:zhangweisjz@gmail.com] 
发送时间: 2015年3月16日 11:08
收件人: user@storm.apache.org
主题: Re: Why Trident always emit tuples?

 

Please review the screenshot attached.



On Mon, Mar 16, 2015 at 11:06 AM 张炜 <zh...@gmail.com> wrote:

Dear all,

I found an interesting problem when I use Trident, please kindly help.


Even there is no operation in spout.execute() command, Storm UI still shows that lots of tuples being emitted. Please refer to the Screenshot attached. Also the source code is shown below ( the source codes might not be exact the same as in eclipse because of the format problem, it is to show logic):


 





tpy.newStream("bbb", new BaseRichSpout() {

@Override

public void declareOutputFields(OutputFieldsDeclarer declarer) {

declarer.declare(new Fields("lines"));

}

@Override

public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {

// TODO Auto-generated method stub

}

 

@Override

public void nextTuple() {

// TODO Auto-generated method stub

}

}).each(new Fields("lines"), new Filter() {

 

@Override

public void prepare(Map conf, TridentOperationContext context) {

// TODO Auto-generated method stub

}

 

@Override

public void cleanup() {

// TODO Auto-generated method stub

}

 

@Override

public boolean isKeep(TridentTuple tuple) {

System.out.println(tuple);

return false;

}

});

 

Thank you very much!

 





Regards,

Sai