PipelineComponent.IsInputReady(Int32[], Boolean[]) Method

Definition

Determines which of the inputs attached to a component are waiting for more data, and which have enough data to process and are blocked.

public:
 virtual void IsInputReady(cli::array <int> ^ inputIDs, cli::array <bool> ^ % canProcess);
public virtual void IsInputReady (int[] inputIDs, ref bool[] canProcess);
abstract member IsInputReady : int[] * Boolean[] -> unit
override this.IsInputReady : int[] * Boolean[] -> unit
Public Overridable Sub IsInputReady (inputIDs As Integer(), ByRef canProcess As Boolean())

Parameters

inputIDs
Int32[]

An array of the IDs of the inputs attached to the component.

canProcess
Boolean[]

An array of Boolean values that indicate whether each input is waiting for more data (true), or is blocked (false), passed by reference.

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.

Remarks

When you set the value of the Microsoft.SqlServer.Dts.Pipeline.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.

Applies to