参考:
- http://www.cnblogs.com/hseagle/p/3756862.html
- http://www.flyne.org/article/216
从TridentTopology到基本的Topology有三层,下图给出一个全局的视图。下图引自徽沪一郎的blog
TridentTopology属性
//一个simple directed graph |
Node Type
- Node
- SpoutNode
- ProcessorNode
- PartitionNode
public static enum SpoutType { |
TridentTopology#newStream
create a BATCH SpoutNode
with ITridentSpout
,若不是ITridentSpout
最终也会被包装成ITridentSpout
- IRichSpout : RichSpoutBatchExecutor
- IBatchSpout : BatchSpoutExecutor
- IPartitionedTridentSpout : PartitionedTridentSpoutExecutor
- IOpaquePartitionedTridentSpout : OpaquePartitionedTridentSpoutExecutor
TridentTopology#newDRPCStream
create a DRPC SpoutNode
with DRPCSpout
,没有txid
TridentTopology#newStaticState
create a Node
with NodeStateInfo
奇怪,一直以为只会创建Node
的子类?
Node name,Stream name,StreamId
TridentTopology 直接创建的Node name都为空,相应的Stream的name也为空。
Stream的name可以通过Stream#name(String name)来修改,但与之相依的Node的name不能相应改变。
当在Stream通过operation创建新的Node时,Node的name为创建它的Stream的name。
Stream operation create new Node,generally,create a new stream id,except operation partition
,new node using it's parent streamId.
build
//其中mergedGroups为spoutGroup,boltGroup |
public SpoutDeclarer setBatchPerTupleSpout(String id, String streamName, IRichSpout spout, Integer parallelism, |
public SpoutDeclarer setSpout(String id, String streamName, String txStateId, ITridentSpout spout, |