public final class SpoutWrapper<OUT> extends RichParallelSourceFunction<OUT> implements org.apache.flink.api.common.functions.StoppableFunction
SpoutWrapper wraps an IRichSpout in order to execute it within a Flink Streaming program. It
takes the spout's output tuples and transforms them into Flink tuples of type OUT (see
SpoutCollector for supported types).SpoutWrapper calls the wrapped spout's nextTuple() method in
an infinite loop.SpoutWrapper can call nextTuple() for a finite number of
times and terminate automatically afterwards (for finite input streams). The number of nextTuple() calls can
be specified as a certain number of invocations or can be undefined. In the undefined case, SpoutWrapper
terminates if no record was emitted to the output collector for the first time during a call to
nextTuple().FiniteSpout interface and numberOfInvocations is not provided or
is null, SpoutWrapper calls nextTuple() method until
FiniteSpout.reachedEnd() returns true.SourceFunction.SourceContext<T>| Constructor and Description |
|---|
SpoutWrapper(backtype.storm.topology.IRichSpout spout)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Collection<String> rawOutputs)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Collection<String> rawOutputs,
Integer numberOfInvocations)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Integer numberOfInvocations)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String[] rawOutputs)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String[] rawOutputs,
Integer numberOfInvocations)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. |
SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String name,
Collection<String> rawOutputs,
Integer numberOfInvocations)
Instantiates a new
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
close() |
void |
run(SourceFunction.SourceContext<OUT> ctx) |
void |
setStormTopology(backtype.storm.generated.StormTopology stormTopology)
Sets the original Storm topology.
|
void |
stop() |
public SpoutWrapper(backtype.storm.topology.IRichSpout spout)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. The output type will be one of Tuple0 to
Tuple25 depending on the spout's declared number of attributes.spout - The spout to be used.IllegalArgumentException - If the number of declared output attributes is not with range [0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Integer numberOfInvocations)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. The output type will be one of Tuple0 to
Tuple25 depending on the spout's declared number of attributes.spout - The spout to be used.numberOfInvocations - The number of calls to ISpout.nextTuple(). If value is negative, SpoutWrapper
terminates if no tuple was emitted for the first time. If value is null, finite invocation is
disabled.IllegalArgumentException - If the number of declared output attributes is not with range [0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String[] rawOutputs)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. The output type can be any type if parameter
rawOutput is true and the spout's number of declared output tuples is 1. If rawOutput is
false the output type will be one of Tuple0 to Tuple25 depending on the spout's declared
number of attributes.spout - The spout to be used.rawOutputs - Contains stream names if a single attribute output stream, should not be of type Tuple1 but be
of a raw type. (Can be null.)IllegalArgumentException - If rawOuput is true and the number of declared output attributes is not 1 or if
rawOuput is false and the number of declared output attributes is not with range
[0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String[] rawOutputs,
Integer numberOfInvocations)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. The output type can be any type if parameter
rawOutput is true and the spout's number of declared output tuples is 1. If rawOutput is
false the output type will be one of Tuple0 to Tuple25 depending on the spout's declared
number of attributes.spout - The spout to be used.rawOutputs - Contains stream names if a single attribute output stream, should not be of type Tuple1 but be
of a raw type. (Can be null.)numberOfInvocations - The number of calls to ISpout.nextTuple(). If value is negative, SpoutWrapper
terminates if no tuple was emitted for the first time. If value is null, finite invocation is
disabled.IllegalArgumentException - If rawOuput is true and the number of declared output attributes is not 1 or if
rawOuput is false and the number of declared output attributes is not with range
[0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Collection<String> rawOutputs)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout in an infinite loop. The output type can be any type if parameter
rawOutput is true and the spout's number of declared output tuples is 1. If rawOutput is
false the output type will be one of Tuple0 to Tuple25 depending on the spout's declared
number of attributes.spout - The spout to be used.rawOutputs - Contains stream names if a single attribute output stream, should not be of type Tuple1 but be
of a raw type. (Can be null.)IllegalArgumentException - If rawOuput is true and the number of declared output attributes is not 1 or if
rawOuput is false and the number of declared output attributes is not with range
[0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
Collection<String> rawOutputs,
Integer numberOfInvocations)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. The output type can be any type if parameter
rawOutput is true and the spout's number of declared output tuples is 1. If rawOutput is
false the output type will be one of Tuple0 to Tuple25 depending on the spout's declared
number of attributes.spout - The spout to be used.rawOutputs - Contains stream names if a single attribute output stream, should not be of type Tuple1 but be
of a raw type. (Can be null.)numberOfInvocations - The number of calls to ISpout.nextTuple(). If value is negative, SpoutWrapper
terminates if no tuple was emitted for the first time. If value is null, finite invocation is
disabled.IllegalArgumentException - If rawOuput is true and the number of declared output attributes is not 1 or if
rawOuput is false and the number of declared output attributes is not with range
[0;25].public SpoutWrapper(backtype.storm.topology.IRichSpout spout,
String name,
Collection<String> rawOutputs,
Integer numberOfInvocations)
throws IllegalArgumentException
SpoutWrapper that calls the nextTuple() method of
the given spout a finite number of times. The output type can be any type if parameter
rawOutput is true and the spout's number of declared output tuples is 1. If rawOutput is
false the output type will be one of Tuple0 to Tuple25 depending on the spout's declared
number of attributes.spout - The spout to be used.name - The name of the spout.rawOutputs - Contains stream names if a single attribute output stream, should not be of type Tuple1 but be
of a raw type. (Can be null.)numberOfInvocations - The number of calls to ISpout.nextTuple(). If value is negative, SpoutWrapper
terminates if no tuple was emitted for the first time. If value is null, finite invocation is
disabled.IllegalArgumentException - If rawOuput is true and the number of declared output attributes is not 1 or if
rawOuput is false and the number of declared output attributes is not with range
[0;25].public void setStormTopology(backtype.storm.generated.StormTopology stormTopology)
stormTopology - The original Storm topology.public final void run(SourceFunction.SourceContext<OUT> ctx) throws Exception
run in interface SourceFunction<OUT>Exceptionpublic void cancel()
Sets the isRunning flag to false.
cancel in interface SourceFunction<OUT>public void stop()
Sets the isRunning flag to false.
stop in interface org.apache.flink.api.common.functions.StoppableFunctionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.