Class OutputPort<TOutput>
Generic class for dataflow (non-error) output ports. Create these ports with Create<TOutput>(String), or use a dataflow worker that already has the appropriate port(s) added.
Note: As per normal, unless otherwise noted, the instance members are not thread-safe, and should only be used from the worker that the port belongs to.
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public sealed class OutputPort<TOutput> : OutputPortBase<TOutput> where TOutput : class
Type Parameters
| Name | Description |
|---|---|
| TOutput | The type of the output rows. |
Properties
HasBufferDemand
Returns true if the port State is Active (or can be
automatically set to Active from the Ready state), and there is
at least RowsPerBuffer demand for additional rows;
otherwise false.
Declaration
public bool HasBufferDemand { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
HasRowDemand
Returns true if there is demand for at least one additional row
(irrespective of port state), otherwise false.
Declaration
public bool HasRowDemand { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Methods
HasBufferDemandAsync()
Waits asynchronously until there is demand for at least RowsPerBuffer
rows, or the port State is Canceled or completed.
Declaration
public Task<bool> HasBufferDemandAsync()
Returns
| Type | Description | ||||
|---|---|---|---|---|---|
| Task<Boolean> |
|
SendBuffer(TOutput[])
Sends the (no more than RowsPerBuffer) rows in the whole array to the downstream worker.
The caller must ensure there is sufficient row demand before calling this method.
Declaration
public void SendBuffer(TOutput[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException |
|
SendBuffer(TOutput[], Int32)
Sends the (no more than RowsPerBuffer) rows in a section of an array to
the downstream worker, starting at index 0.
The caller must ensure there is sufficient row demand before calling this method.
Declaration
public void SendBuffer(TOutput[] array, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | count | The number of rows to send, at most |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException |
|
SendBuffer(TOutput[], Int32, Int32)
Sends the (no more than RowsPerBuffer) rows in a section of an array to the downstream worker.
The caller must ensure there is sufficient row demand before calling this method.
Declaration
public void SendBuffer(TOutput[] array, int start, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | start | The start index. |
| Int32 | count | The number of rows to send, at most |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException |
|
SendRow(TOutput)
Sends a row to the downstream worker.
The caller must ensure there is sufficient row demand before calling this method.
Declaration
public void SendRow(TOutput row)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput | row | The row. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException |
|
SendRowAsync(TOutput)
Sends a row asynchronously to the downstream worker.
Note that this method does not require checking for sufficient row demand before calling it.
Declaration
public Task<bool> SendRowAsync(TOutput row)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput | row | The row. |
Returns
| Type | Description |
|---|---|
| Task<Boolean> |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Row was |
SendRowsAsync(TOutput[])
Sends all the rows of an array to the downstream worker.
Note that this method does not require checking for sufficient rows demand before calling it, and it supports sending an arbitrary number of rows (including more than RowsPerBuffer).
Declaration
public Task<bool> SendRowsAsync(TOutput[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | A |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| InvalidOperationException | Row was |
SendRowsAsync(TOutput[], Int32)
Sends the rows in a section of an array to the downstream worker, starting from index 0.
Note that this method does not require checking for sufficient rows demand before calling it, and it supports sending an arbitrary number of rows (including more than RowsPerBuffer).
Declaration
public Task<bool> SendRowsAsync(TOutput[] array, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | count | The number of rows to send. If |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | A |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| InvalidOperationException | Row was |
SendRowsAsync(TOutput[], Int32, Int32)
Sends the rows in a section of an array to the downstream worker.
Note that this method does not require checking for sufficient rows demand before calling it, and it supports sending an arbitrary number of rows (including more than RowsPerBuffer).
Declaration
public Task<bool> SendRowsAsync(TOutput[] array, int start, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | start | The start index. |
| Int32 | count | The number of rows to send. If |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | A |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| InvalidOperationException | Row was |
SendRowsAsync(IEnumerable<TOutput>)
Sends all the rows in the enumerable to the downstream worker.
Note that this method does not require checking for sufficient rows demand before calling it, and it supports sending an arbitrary number of rows (including more than RowsPerBuffer).
Declaration
public Task<bool> SendRowsAsync(IEnumerable<TOutput> enumerableRows)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TOutput> | enumerableRows | The enumerable. Note that it is inherently synchronous, and will block a thread (i.e. consume extra memory etc.) if it cannot supply rows as quickly as the downstream worker consumes them. |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | A |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| InvalidOperationException | Row was |
TrySendBuffer(TOutput[])
Try sending all (at most RowsPerBuffer) rows in the array to the downstream worker.
Note that this method does not wait for row demand to become available.
Declaration
public bool TrySendBuffer(TOutput[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array, with at most |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException | Row was |
TrySendBuffer(TOutput[], Int32)
Try sending (at most RowsPerBuffer) rows to the downstream worker,
starting from index 0 in the array.
Note that this method does not wait for row demand to become available.
Declaration
public bool TrySendBuffer(TOutput[] array, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | count | The number of rows to send, at most |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException | Row was |
TrySendBuffer(TOutput[], Int32, Int32)
Try sending (at most RowsPerBuffer) rows to the downstream worker.
Note that this method does not wait for row demand to become available.
Declaration
public bool TrySendBuffer(TOutput[] array, int start, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput[] | array | The array. |
| Int32 | start | The start index. |
| Int32 | count | The number of rows to send, at most |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentOutOfRangeException | Row count larger than |
| InvalidOperationException | Row was |
TrySendRow(TOutput)
Sends a row to the downstream worker if there is any row demand.
Declaration
public bool TrySendRow(TOutput row)
Parameters
| Type | Name | Description |
|---|---|---|
| TOutput | row | The row. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Row was |