@InterfaceStability.Evolving public class ApexStreamImpl<T> extends Object implements ApexStream<T>
populateDag(DAG) is called| Modifier and Type | Class and Description |
|---|---|
static class |
ApexStreamImpl.Brick<T>
The extension point of the stream
|
| Modifier and Type | Field and Description |
|---|---|
protected DagMeta |
graph
Graph behind the stream
|
protected ApexStreamImpl.Brick<T> |
lastBrick
Right now the stream only support single extension point
You can have multiple downstream operators connect to this single extension point though
|
| Constructor and Description |
|---|
ApexStreamImpl() |
ApexStreamImpl(ApexStreamImpl<T> apexStream) |
ApexStreamImpl(DagMeta graph) |
ApexStreamImpl(DagMeta graph,
ApexStreamImpl.Brick<T> lastBrick) |
| Modifier and Type | Method and Description |
|---|---|
<O,INSTREAM extends ApexStream<T>,OUTSTREAM extends ApexStream<O>> |
addCompositeStreams(CompositeStreamTransform<INSTREAM,OUTSTREAM> compositeStreamTransform)
Extend the dag by adding one
CompositeStreamTransform |
<O,STREAM extends ApexStream<O>> |
addOperator(com.datatorrent.api.Operator op,
com.datatorrent.api.Operator.InputPort<T> inputPort,
com.datatorrent.api.Operator.OutputPort<O> outputPort,
Option... opts)
Extend the dag by adding one operator
|
<STREAM extends ApexStream<Map.Entry<Object,Integer>>> |
countByElement() |
com.datatorrent.api.DAG |
createDag()
Create dag from stream
|
<O,STREAM extends ApexStream<O>> |
endWith(com.datatorrent.api.Operator op,
com.datatorrent.api.Operator.InputPort<T> inputPort,
Option... opts)
Extend the dag by adding one end operator
|
<STREAM extends ApexStream<T>> |
filter(Function.FilterFunction<T> filter,
Option... opts)
Filter transformation
Add an operator to the DAG which filter out tuple T that cannot satisfy the FilterFunction |
<O,STREAM extends ApexStream<O>> |
flatMap(Function.FlatMapFunction<T,O> flatten,
Option... opts)
Flat map transformation
Add an operator to the DAG which convert tuple T to a collection of tuple O
|
ApexStreamImpl.Brick<T> |
getLastBrick() |
<O,STREAM extends ApexStream<O>> |
map(Function.MapFunction<T,O> mf,
Option... opts)
Simple map transformation
Add an operator to the DAG which convert tuple T to tuple O |
protected <O> ApexStream<O> |
newStream(DagMeta graph,
ApexStreamImpl.Brick<O> newBrick) |
void |
populateDag(com.datatorrent.api.DAG dag)
Populate existing dag
|
ApexStreamImpl<T> |
print()
Add a stdout console output operator
|
ApexStreamImpl<T> |
print(Option... opts)
Add a stdout console output operator
|
ApexStream<T> |
printErr()
Add a stderr console output operator
|
void |
run()
Submit the application to cluster
|
void |
runEmbedded(boolean async,
long duration,
Callable<Boolean> exitCondition)
Run the stream application in local mode
In Async mode, the method would return immediately and the dag would run for "duration" milliseconds
In Sync mode, the method would block "duration" milliseconds to run the dag
If duration is negative the dag would run forever until being killed
|
ApexStream<T> |
setGlobalAttribute(com.datatorrent.api.Attribute attribute,
Object value)
Set attributes at the DAG level
|
void |
setLastBrick(ApexStreamImpl.Brick<T> lastBrick) |
<STREAM extends ApexStream<T>> |
union(ApexStream<T>... others)
Union multiple stream into one
|
WindowedStream<T> |
window(WindowOption option)
Chunk tuples into Windows
Window Transform are defined in
WindowedStream |
WindowedStream<T> |
window(WindowOption windowOption,
TriggerOption triggerOption)
Chunk tuple into windows with window option and trigger option
|
WindowedStream<T> |
window(WindowOption windowOption,
TriggerOption triggerOption,
org.joda.time.Duration allowLateness)
Chunk tuple into windows with window option and trigger option and allowed lateness
|
ApexStream<T> |
with(com.datatorrent.api.Attribute attribute,
Object value)
Set the attribute value
If it is DAG attribute, it will be applied to the whole DAG If it is Operator attribute, it will be applied to last connected operatorIf it is InputPort attribute, it will be applied to the input port of the last connected streamIf it is OutputPort attribute, it will be applied to the output port of the last connected streamIf it is both InputPort&OutputPort attribute, it will be applied to last connected stream |
ApexStream<T> |
with(com.datatorrent.api.DAG.Locality locality)
Set the locality
|
ApexStream<T> |
with(String propName,
Object value)
Set the property value of the last connected operator
|
protected DagMeta graph
protected ApexStreamImpl.Brick<T> lastBrick
public ApexStreamImpl()
public ApexStreamImpl(ApexStreamImpl<T> apexStream)
public ApexStreamImpl(DagMeta graph)
public ApexStreamImpl(DagMeta graph, ApexStreamImpl.Brick<T> lastBrick)
public ApexStreamImpl.Brick<T> getLastBrick()
public void setLastBrick(ApexStreamImpl.Brick<T> lastBrick)
public <O,STREAM extends ApexStream<O>> STREAM map(Function.MapFunction<T,O> mf, Option... opts)
ApexStreammap in interface ApexStream<T>O - Type of the outputmf - map functionpublic <O,STREAM extends ApexStream<O>> STREAM flatMap(Function.FlatMapFunction<T,O> flatten, Option... opts)
ApexStreamflatMap in interface ApexStream<T>O - Type of the outputflatten - flat mappublic <STREAM extends ApexStream<T>> STREAM filter(Function.FilterFunction<T> filter, Option... opts)
ApexStreamfilter in interface ApexStream<T>filter - filter functionpublic <STREAM extends ApexStream<Map.Entry<Object,Integer>>> STREAM countByElement()
public <O,STREAM extends ApexStream<O>> STREAM endWith(com.datatorrent.api.Operator op, com.datatorrent.api.Operator.InputPort<T> inputPort, Option... opts)
ApexStreamendWith in interface ApexStream<T>O - type of the outputop - Operator added to the streaminputPort - InputPort of the operator that is connected to last exposed OutputPort in the streampublic <O,STREAM extends ApexStream<O>> STREAM addOperator(com.datatorrent.api.Operator op, com.datatorrent.api.Operator.InputPort<T> inputPort, com.datatorrent.api.Operator.OutputPort<O> outputPort, Option... opts)
ApexStreamaddOperator in interface ApexStream<T>O - type of the outputop - Operator added to the streaminputPort - InputPort of the operator that is connected to last exposed OutputPort in the streamoutputPort - OutputPort of the operator will be connected to next operatorpublic <O,INSTREAM extends ApexStream<T>,OUTSTREAM extends ApexStream<O>> OUTSTREAM addCompositeStreams(CompositeStreamTransform<INSTREAM,OUTSTREAM> compositeStreamTransform)
ApexStreamCompositeStreamTransformaddCompositeStreams in interface ApexStream<T>compositeStreamTransform - Composite Streams and Transformspublic <STREAM extends ApexStream<T>> STREAM union(ApexStream<T>... others)
ApexStreamunion in interface ApexStream<T>others - other streamspublic ApexStreamImpl<T> print(Option... opts)
ApexStreamprint in interface ApexStream<T>public ApexStreamImpl<T> print()
ApexStreamprint in interface ApexStream<T>public ApexStream<T> printErr()
ApexStreamprintErr in interface ApexStream<T>public ApexStream<T> with(com.datatorrent.api.Attribute attribute, Object value)
ApexStreamDAG attribute, it will be applied to the whole DAG Operator attribute, it will be applied to last connected operatorInputPort attribute, it will be applied to the input port of the last connected streamOutputPort attribute, it will be applied to the output port of the last connected streamInputPort&OutputPort attribute, it will be applied to last connected streamwith in interface ApexStream<T>attribute - Attributevalue - value of the attributepublic ApexStream<T> setGlobalAttribute(com.datatorrent.api.Attribute attribute, Object value)
ApexStreamsetGlobalAttribute in interface ApexStream<T>attribute - Attributevalue - value of the attributepublic ApexStream<T> with(com.datatorrent.api.DAG.Locality locality)
ApexStreamwith in interface ApexStream<T>locality - DAG.Localitypublic ApexStream<T> with(String propName, Object value)
ApexStreamwith in interface ApexStream<T>propName - property namevalue - value of the propertypublic com.datatorrent.api.DAG createDag()
ApexStreamcreateDag in interface ApexStream<T>DAGpublic void populateDag(com.datatorrent.api.DAG dag)
ApexStreampopulateDag in interface ApexStream<T>dag - DAGpublic void runEmbedded(boolean async,
long duration,
Callable<Boolean> exitCondition)
ApexStreamrunEmbedded in interface ApexStream<T>async - true if run in Async mode
false if run in sync modepublic void run()
ApexStreamrun in interface ApexStream<T>public WindowedStream<T> window(WindowOption option)
ApexStreamWindowedStreamwindow in interface ApexStream<T>public WindowedStream<T> window(WindowOption windowOption, TriggerOption triggerOption)
ApexStreamwindow in interface ApexStream<T>public WindowedStream<T> window(WindowOption windowOption, TriggerOption triggerOption, org.joda.time.Duration allowLateness)
ApexStreamwindow in interface ApexStream<T>protected <O> ApexStream<O> newStream(DagMeta graph, ApexStreamImpl.Brick<O> newBrick)
Copyright © 2015-2017 Apache Software Foundation. All Rights Reserved.