PipelineComponent.IsInputReady Method
Determines which of the inputs attached to a component are waiting for more data, and which have enough data to process and are blocked.
Namespace: Microsoft.SqlServer.Dts.Pipeline
Assembly: Microsoft.SqlServer.PipelineHost (in Microsoft.SqlServer.PipelineHost.dll)
Syntax
'Declaration
Public Overridable Sub IsInputReady ( _
inputIDs As Integer(), _
ByRef canProcess As Boolean() _
)
'Usage
Dim instance As PipelineComponent
Dim inputIDs As Integer()
Dim canProcess As Boolean()
instance.IsInputReady(inputIDs, canProcess)
public virtual void IsInputReady(
int[] inputIDs,
ref bool[] canProcess
)
public:
virtual void IsInputReady(
array<int>^ inputIDs,
array<bool>^% canProcess
)
abstract IsInputReady :
inputIDs:int[] *
canProcess:bool[] byref -> unit
override IsInputReady :
inputIDs:int[] *
canProcess:bool[] byref -> unit
public function IsInputReady(
inputIDs : int[],
canProcess : boolean[]
)
Parameters
- inputIDs
Type: array<System.Int32[]
An array of the IDs of the inputs attached to the component.
- canProcess
Type: array<System.Boolean[]%
An array of Boolean values that indicate whether each input is waiting for more data (true), or is blocked (false), passed by reference.
Remarks
When you set the value of the DtsPipelineComponentAttribute.SupportsBackPressure property to true in the DtsPipelineComponentAttribute, you must also provide an implementation for the IsInputReady method.
The data flow engine calls the IsInputReady method to determine which inputs are waiting to receive more data. In your implementation of this method, you set the status of each of the component's inputs in the Boolean canProcess array. (The inputs are identified by their ID values in the inputIDs array.) When you set the value of an input to true in the canProcess array, the data flow engine calls the component's ProcessInput method and provides more data for the specified input.
While more upstream data is available, the value of at least one input must always be true in the canProcess array, or processing stops.
For more information about the handling of excessive memory usage if the inputs of a custom data flow component produce data at uneven rates, see Developing Data Flow Components with Multiple Inputs.
Examples
In the following example, the implementation of the IsInputReady method indicates that an input is waiting to receive more data when the following conditions are true:
More upstream data is available for the input (!inputEOR).
The component does not currently have data available to process for the input in the buffers that the component has already received (inputBuffers[inputIndex].CurrentRow() == null).
If an input is waiting to receive more data, the data flow component indicates this by setting to true the value of the element in the canProcess array that corresponds to that input.
Conversely, when the component still has data available to process for the input, the example suspends the processing of the input. The example does this by setting to false the value of the element in the canProcess array that corresponds to that input.
public override void IsInputReady(int[] inputIDs, ref bool[] canProcess)
{
for (int i = 0; i < inputIDs.Length; i++)
{
int inputIndex = ComponentMetaData.InputCollection.GetObjectIndexByID(inputIDs[i]);
canProcess[i] = (inputBuffers[inputIndex].CurrentRow() == null)
&& !inputEOR[inputIndex];
}
}
The preceding example uses the Boolean inputEOR array to indicate whether more upstream data is available for each input. EOR in the name of the array represents "end of rowset" and refers to the EndOfRowset property of data flow buffers. In a portion of the example that is not included here, the ProcessInput method checks the value of the EndOfRowset property for each buffer of data that it receives. When a value of true indicates that there is no more upstream data available for an input, the example sets the value of inputEOR to true for that input. This implementation of the IsInputReady method sets the corresponding value in the canProcess array to false for an input when the value of inputEOR indicates that there is no more upstream data available for the input.