Class SupplierSource<R>
- java.lang.Object
-
- org.apache.heron.api.topology.BaseComponent
-
- org.apache.heron.api.spout.BaseRichSpout
-
- org.apache.heron.streamlet.impl.sources.StreamletSource
-
- org.apache.heron.streamlet.impl.sources.SupplierSource<R>
-
- All Implemented Interfaces:
Serializable,IRichSpout,ISpout,IComponent,IStatefulComponent<Serializable,Serializable>
public class SupplierSource<R> extends StreamletSource
SupplierSource is a way to wrap a supplier function inside a Heron Spout. The SupplierSource just calls the get method of the supplied function to generate the next tuple.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.heron.streamlet.impl.sources.StreamletSource
collector
-
-
Constructor Summary
Constructors Constructor Description SupplierSource(SerializableSupplier<R> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnextTuple()When this method is called, Heron is requesting that the Spout emit tuples to the output collector.-
Methods inherited from class org.apache.heron.streamlet.impl.sources.StreamletSource
declareOutputFields, initState, open, preSave
-
Methods inherited from class org.apache.heron.api.spout.BaseRichSpout
ack, activate, close, deactivate, fail
-
Methods inherited from class org.apache.heron.api.topology.BaseComponent
getComponentConfiguration
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.heron.api.topology.IComponent
getComponentConfiguration
-
-
-
-
Constructor Detail
-
SupplierSource
public SupplierSource(SerializableSupplier<R> supplier)
-
-
Method Detail
-
nextTuple
public void nextTuple()
Description copied from interface:ISpoutWhen this method is called, Heron is requesting that the Spout emit tuples to the output collector. This method should be non-blocking, so if the Spout has no tuples to emit, this method should return. nextTuple, ack, and fail are all called in a tight loop in a single thread in the spout task. When there are no tuples to emit, it is courteous to have nextTuple sleep for a short amount of time (like a single millisecond) so as not to waste too much CPU.
-
-