您当前的位置: 首页 > 

宝哥大数据

暂无认证

  • 0浏览

    0关注

    1029博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Storm学习00--IComponent

宝哥大数据 发布时间:2017-03-12 20:49:12 ,浏览量:0

##IComponent IComponent继承Serializable接口, 为topology中所有可能组件提供共同的方法。

 interface IComponent extends Serializable
提供两个方法

/**
 * Common methods for all possible components in a topology. This interface is used
 * when defining topologies using the Java API. 
 */
public interface IComponent extends Serializable {

    /**
     * Declare the output schema for all the streams of this topology.
     *
     * @param declarer this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
     */
    void declareOutputFields(OutputFieldsDeclarer declarer);

    /**
     * Declare configuration specific to this component. Only a subset of the "topology.*" configs can
     * be overridden. The component configuration can be further overridden when constructing the 
     * topology using {@link TopologyBuilder}
     *
     */
    Map getComponentConfiguration();

}

1.1 declareOutputFields(OutputFieldsDeclarer declarer)

  此方法用于声明当前Spout的Tuple发送流。Stream流的定义是通过OutputFieldsDeclarer.declare方法完成的,其中的参数包括了发送的域Fields。 如: 在RandomSentenceSpout中重写了


  @Override
  public void declareOutputFields(OutputFieldsDeclarer declarer) {
    declarer.declare(new Fields("word"));}  
1.2 getComponentConfiguration();

 &mesp;此方法用于声明针对当前组件的特殊的Configuration配置。

这里写图片描述

关注
打赏
1587549273
查看更多评论
立即登录/注册

微信扫码登录

0.0436s