3.1.4.3 Executing a Pipeline

The higher layer can initiate the execution of a pipeline on the server at any time as long as the RunspacePool is in Opened (section 3.1.1.2) state. The following activities happen as part of the pipeline execution. During the pipeline creation time, the client sends messages to a server and receives messages back from the server. The client expects specific messages from the server at each stage as described later in this section. If the client does not receive the expected messages at each stage, the client terminates the pipeline execution (section 3.1.4.3) and notifies the higher layer. If a wxf:Fault message is received at any stage, the client reports the failure to the higher layer and stops the pipeline (as specified in section 3.1.5.3.13).

  1. The client creates a new pipeline, assigns a unique GUID to this pipeline (section 3.1.1.3.1), and initializes the pipeline state (section 3.1.1.3.2) to Running. The client adds this pipeline instance to the RunspacePool's pipeline table (section 3.1.1.2.6). The client constructs a CREATE_PIPELINE message (section 2.2.2.10) and sends it to the server using wxf:Command (section 3.1.5.3.3) and (if needed) wxf:Send (section 3.1.5.3.5) messages.

  2. After sending all fragments of a CREATE_PIPELINE message, the client stores the CommandId (sections 3.1.1.3.4 and 3.1.1.1.2) and MUST send a wxf:Receive message to start receiving data from the pipeline on the server. After each received wxf:ReceiveResponse message, the client MUST send another wxf:Receive message if the pipeline is not in a Completed or Stopped state.

  3. At this stage, the client interacts with the higher layer in three ways concurrently:

    • The client reads input data (if any) from the higher layer, constructs a PIPELINE_INPUT message (section 3.1.5.4.17), and sends it to a server. This process is repeated for all the input objects provided by the higher layer. When the higher layer signals that all input data has been provided, the client MUST send an END_OF_PIPELINE_INPUT message (section 2.2.2.18).

    • The client receives result messages from the server and hands over the result data to the higher layer. Only the following result messages are expected at this stage: PIPELINE_OUTPUT (section 2.2.2.19), ERROR_RECORD (section 2.2.2.20), DEBUG_RECORD (section 2.2.2.22), VERBOSE_RECORD (section 2.2.2.23), WARNING_RECORD (section 2.2.2.24), PROGRESS_RECORD (section 2.2.2.25), INFORMATION_RECORD (section 2.2.2.26), PIPELINE_HOST_CALL (section 2.2.2.27), and PIPELINE_STATE (section 2.2.2.21). If the client receives any other message, then the client MUST stop the pipeline (section 3.1.4.3). When a PIPELINE_STATE message is received, then the client stops sending input data and skips to step 4.

    • If the higher layer stops the pipeline 3.1.4.4, the client does not execute steps 4 and 5.

  4. If a PIPELINE_STATE message (section 3.1.5.4.21) is received, the client changes the pipeline state (section 3.1.1.3.2) according to the message received and notifies the higher-layer.

  5. When the pipeline reaches Completed or Failed state, the client removes the pipeline instance from the global table (section 3.1.1.1.2) and the RunspacePool's pipeline table (section 3.1.1.2.6).