Class Network
The network class allows you execute, monitor and cancel data flows. You need to provide at least one start node to run the network. All other linked components will be retrieved automatically. If you provide more nodes, the algorithm will determine if a network has already started or not and ignore the other nodes. It is recommend to pass only one node from the network.
Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
public sealed class Network
Examples
Network.Execute(source1);
Network.Execute(source1, source2); //If source1 and source2 are in the same network, providing source2 is superflous
Task t = Network.ExecuteAsync(dest1);
t.Wait();
Constructors
Network()
Declaration
public Network()
Network(params IDataFlowComponent[])
Declaration
public Network(params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
IDataFlowComponent[] | startNodes |
Properties
AllNodes
Declaration
public ReadOnlyCollection<IDataFlowComponent> AllNodes { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<IDataFlowComponent> |
AllowMultipleExecutions
Declaration
public bool? AllowMultipleExecutions { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Destinations
Declaration
public ReadOnlyCollection<IDataFlowDestination> Destinations { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<IDataFlowDestination> |
IgnoreUnlinkedNodes
Declaration
public bool IgnoreUnlinkedNodes { get; set; }
Property Value
Type | Description |
---|---|
bool |
Sources
Declaration
public ReadOnlyCollection<IDataFlowExecutableSource> Sources { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<IDataFlowExecutableSource> |
StartNodes
Declaration
public ICollection<IDataFlowComponent> StartNodes { get; set; }
Property Value
Type | Description |
---|---|
ICollection<IDataFlowComponent> |
Methods
ApplyToAllNodes(Action<IDataFlowComponent>)
Will apply the given action on all nodes in the network.
Declaration
public Network ApplyToAllNodes(Action<IDataFlowComponent> onNode)
Parameters
Type | Name | Description |
---|---|---|
Action<IDataFlowComponent> | onNode | An action that is performed on each node. |
Returns
Type | Description |
---|---|
Network | The current Network instance. |
Cancel()
Cancel the BufferCompletion(s) on all nodes in the network, will start cancelation from the sources. This will result in all nodes canceled in the whole network.
Declaration
public void Cancel()
Cancel(params IDataFlowComponent[])
Cancel the BufferCompletion(s) on all nodes in the network, will start cancelation from the sources. This will result in all nodes canceled in the whole network.
Declaration
public static void Cancel(params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
IDataFlowComponent[] | startNodes | The start nodes - only one node in the whole network is sufficient |
Execute()
Will execute the data flow for the whole network synchronously. The network is derived from the given StartNodes (only one node of the network is needed)
Declaration
public void Execute()
Execute(params IDataFlowComponent[])
Will execute the data flow for the whole network synchronously.
Declaration
public static void Execute(params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
IDataFlowComponent[] | startNodes | At least one node in the network that should be executed - can by any node in the network |
Execute(CancellationToken)
Will execute the data flow for the whole network synchronously. The network is derived from the given StartNodes (only one node of the network is needed)
Declaration
public void Execute(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token to cancel the whole network when still running |
Execute(CancellationToken, params IDataFlowComponent[])
Will execute the data flow for the whole network synchronously.
Declaration
public static void Execute(CancellationToken cancellationToken, params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token which cancels the whole network when still running |
IDataFlowComponent[] | startNodes | At least one node in the network that should be executed - can by any node in the network |
ExecuteAsync()
Will execute the data flow for the whole network asynchronously. The network is derived from the given StartNodes (only one node of the network is needed)
Declaration
public Task ExecuteAsync()
Returns
Type | Description |
---|---|
Task | A task that is ran to completion when the whole network is completed. |
ExecuteAsync(params IDataFlowComponent[])
Will execute the data flow for the whole network asynchronously.
Declaration
public static Task ExecuteAsync(params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
IDataFlowComponent[] | startNodes | At least one node in the network that should be executed - can by any node in the network |
Returns
Type | Description |
---|---|
Task |
ExecuteAsync(CancellationToken)
Will execute the data flow for the whole network asynchronously. The network is derived from the given StartNodes (only one node of the network is needed)
Declaration
public Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token to cancel the whole network when running |
Returns
Type | Description |
---|---|
Task | A task that is ran to completion when the whole network is completed. |
ExecuteAsync(CancellationToken, params IDataFlowComponent[])
Will execute the data flow for the whole network asynchronously.
Declaration
public static Task ExecuteAsync(CancellationToken cancellationToken, params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token which cancels the whole network when still running |
IDataFlowComponent[] | startNodes | At least one node in the network that should be executed - can by any node in the network |
Returns
Type | Description |
---|---|
Task |
Init(params IDataFlowComponent[])
Creates a new network with the given start nodes.
Declaration
public static Network Init(params IDataFlowComponent[] startNodes)
Parameters
Type | Name | Description |
---|---|---|
IDataFlowComponent[] | startNodes | At least one or more nodes from the network. Connected nodes will be automatically collected. |
Returns
Type | Description |
---|---|
Network | A new Network instance. |
ParallelExecute(params Network[])
Allows to execute multiple networks in parallel.
Declaration
public static Task ParallelExecute(params Network[] networks)
Parameters
Type | Name | Description |
---|---|---|
Network[] | networks | Network that should run in parallel |
Returns
Type | Description |
---|---|
Task | An awaitable task that completes when all networks are execute successfully. |
PrintAsJson()
Declaration
public string PrintAsJson()
Returns
Type | Description |
---|---|
string |
PrintAsJson(Func<DataFlowComponent, Dictionary<string, object>>)
Prints the network as a json string.
Declaration
public string PrintAsJson(Func<DataFlowComponent, Dictionary<string, object>> propertyExtraction)
Parameters
Type | Name | Description |
---|---|---|
Func<DataFlowComponent, Dictionary<string, object>> | propertyExtraction |
Returns
Type | Description |
---|---|
string |
PrintAsNodes()
Declaration
public NetworkNode PrintAsNodes()
Returns
Type | Description |
---|---|
NetworkNode |
PrintAsNodes(Func<DataFlowComponent, Dictionary<string, object>>)
Create a representation of the network using NetworkNode objects.
Declaration
public NetworkNode PrintAsNodes(Func<DataFlowComponent, Dictionary<string, object>> propertyExtraction)
Parameters
Type | Name | Description |
---|---|---|
Func<DataFlowComponent, Dictionary<string, object>> | propertyExtraction |
Returns
Type | Description |
---|---|
NetworkNode | The current network using NetworkNode objects |
SetLogInstance(ILogger)
Declaration
public Network SetLogInstance(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger |
Returns
Type | Description |
---|---|
Network |