public final class ExternalRecordSource extends ExecutableOperator implements RecordSourceOperator
LogicalGraphInstance#start(). For example:
//create the graph
LogicalGraph graph= LogicalGraphFactory.newLogicalGraph();
//the type of the source
RecordTokenType type=
record( TokenTypeConstant.DOUBLE("field1"),
TokenTypeConstant.DOUBLE("field2"));
//create the external source, adding to the graph
ExternalRecordSource source= graph.add(new ExternalRecordSource(type));
//add some other operator
op= graph.add(...);
//connect source to another operator in the graph
graph.connect(source.getInput(),op.getInput());
//compile the graph
LogicalGraphInstance instance= graph.compile();
//*always* call start to start in background, not run since run will deadlock!!
instance.start();
//produce some data in this thread
RecordOutput rout= source.getInput();
while (...) {
...
rout.push();
}
//push end of data
rout.pushEndOfData();
//after calling pushEndOfData, join on the graph
//don't join before since it will deadlock!
instance.join();
NOTE: this operator is non-parallel
| Constructor and Description |
|---|
ExternalRecordSource()
Default constructor; prior to graph compilation
setOutputType(RecordTokenType)
must be specified. |
ExternalRecordSource(RecordTokenType outputType)
Creates a new record source of the given type.
|
| Modifier and Type | Method and Description |
|---|---|
protected ExecutableOperator |
cloneForExecution()
Performs a deep copy of the operator for execution.
|
protected void |
computeMetadata(StreamingMetadataContext ctx)
Implementations must adhere to the following contracts
|
protected void |
execute(ExecutionContext ctx)
Executes the operator.
|
RecordOutput |
getInput()
Returns the external port that an external application can use to send
data to this sink.
|
RecordPort |
getOutput()
Gets the record port providing the output data from the source.
|
RecordTokenType |
getOutputType()
Returns the output record type of this sink
|
protected void |
notifyError(Throwable e)
Called to notify the operator that the graph terminated abnormally
either before the operator had a chance to run or while the operator
is running.
|
void |
setOutputType(RecordTokenType outputType)
Sets the output record type of this sink
|
getNumInputCopies, getPortSettings, handleInactiveOutputdisableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutputclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisableParallelism, getInputPorts, getOutputPortspublic ExternalRecordSource()
setOutputType(RecordTokenType)
must be specified.public ExternalRecordSource(RecordTokenType outputType)
outputType - the record type of the sourcepublic RecordOutput getInput()
public RecordPort getOutput()
RecordSourceOperatorgetOutput in interface RecordSourceOperatorgetOutput in interface SourceOperator<RecordPort>public RecordTokenType getOutputType()
public void setOutputType(RecordTokenType outputType)
outputType - the output record type of this sinkprotected void computeMetadata(StreamingMetadataContext ctx)
StreamingOperator
StreamingMetadataContext.parallelize(ParallelismStrategy).
RecordPort#setRequiredDataOrdering, otherwise data may arrive in any order.
RecordPort#setRequiredDataDistribution, otherwise data will arrive in an unspecified partial distribution.
RecordPort#getSourceDataDistribution and RecordPort#getSourceDataOrdering. These should be
viewed as a hints to help chose a more efficient algorithm. In such cases, though, operators must
still declare data ordering and data distribution requirements; otherwise there is no guarantee that
data will arrive sorted/distributed as required.
RecordPort#setType.RecordPort#setOutputDataOrderingRecordPort#setOutputDataDistributionAbstractModelPort#setMergeHandler.MergeModel is a convenient, re-usable model reducer, parameterized with
a merge-handler.
SimpleModelPort's have no associated metadata and therefore there is
never any output metadata to declare. PMMLPort's, on the other hand,
do have associated metadata. For all PMMLPorts, implementations must declare
the following:
PMMLPort.setPMMLModelSpec.
computeMetadata in class StreamingOperatorctx - the contextprotected void notifyError(Throwable e)
AbstractLogicalOperatorCompositeOperator, this method will
be invoked if any of the componentsnotifyError in class AbstractLogicalOperatore - the error that occuredprotected ExecutableOperator cloneForExecution()
ExecutableOperatorcloneForExecution in class ExecutableOperatorprotected void execute(ExecutionContext ctx)
ExecutableOperatorexecute in class ExecutableOperatorctx - context in which to lookup physical ports bound to logical portsCopyright © 2016 Actian Corporation. All rights reserved.