Class ParallelSparseSelect<TIn, TBranchKey, TBranchIn, TBranchOut, TOut>
Transforms a stream of messages by splitting it into a set of sub-streams (indexed by a branch key), applying a sub-pipeline to each of these streams, and assembling the results into a corresponding output stream.
Inheritance
Inherited Members
Namespace: Microsoft.Psi.Components
Assembly: Microsoft.Psi.dll
Syntax
public class ParallelSparseSelect<TIn, TBranchKey, TBranchIn, TBranchOut, TOut> : Subpipeline, ISourceComponent, IConsumer<TIn>, IProducer<TOut>
Type Parameters
Name | Description |
---|---|
TIn | The input message type. |
TBranchKey | The key type. |
TBranchIn | The branch input message type. |
TBranchOut | The branch output message type. |
TOut | The output type. |
Remarks
A splitter function is applied to each input message to generate a dictionary, and a subpipeline is created and executed for every new key in the dictionary. The results generated on individual branches are combined to create the output via an output creator function. A branch termination policy function governs when branches are terminated.
Constructors
View SourceParallelSparseSelect(Pipeline, Func<TIn, Dictionary<TBranchKey, TBranchIn>>, Func<TBranchKey, IProducer<TBranchIn>, IProducer<TBranchOut>>, Func<Dictionary<TBranchKey, TBranchOut>, TOut>, Boolean, TBranchOut, Func<TBranchKey, Dictionary<TBranchKey, TBranchIn>, DateTime, (Boolean, DateTime)>, String, DeliveryPolicy)
Initializes a new instance of the ParallelSparseSelect<TIn, TBranchKey, TBranchIn, TBranchOut, TOut> class.
Declaration
public ParallelSparseSelect(Pipeline pipeline, Func<TIn, Dictionary<TBranchKey, TBranchIn>> splitter, Func<TBranchKey, IProducer<TBranchIn>, IProducer<TBranchOut>> transform, Func<Dictionary<TBranchKey, TBranchOut>, TOut> outputCreator, bool outputDefaultIfDropped = false, TBranchOut defaultValue = null, Func<TBranchKey, Dictionary<TBranchKey, TBranchIn>, DateTime, (bool, DateTime)> branchTerminationPolicy = null, string name = "ParallelSparseSelect", DeliveryPolicy defaultDeliveryPolicy = null)
Parameters
Type | Name | Description |
---|---|---|
Pipeline | pipeline | The pipeline to add the component to. |
Func<TIn, Dictionary<TBranchKey, TBranchIn>> | splitter | A function that splits the input by generating a dictionary of key-value pairs for each given input message. |
Func<TBranchKey, IProducer<TBranchIn>, IProducer<TBranchOut>> | transform | Function mapping keyed input producers to output producers. |
Func<Dictionary<TBranchKey, TBranchOut>, TOut> | outputCreator | A function that creates the output message based on a dictionary containing the branch outputs. |
System.Boolean | outputDefaultIfDropped | When true, a result is produced even if a message is dropped in processing one of the input elements. In this case the corresponding output element is set to a default value. |
TBranchOut | defaultValue | Default value to use when messages are dropped in processing one of the input elements. |
Func<TBranchKey, Dictionary<TBranchKey, TBranchIn>, DateTime, System.ValueTuple<System.Boolean, DateTime>> | branchTerminationPolicy | Predicate function determining whether and when (originating time) to terminate branches (defaults to when key no longer present), given the current key, message payload (dictionary) and originating time. |
String | name | Name for this component (defaults to ParallelSparse). |
DeliveryPolicy | defaultDeliveryPolicy | Pipeline-level default delivery policy to be used by this component (defaults to Unlimited if unspecified). |
Properties
View SourceIn
Gets the input we receive messages on.
Declaration
public Receiver<TIn> In { get; }
Property Value
Type | Description |
---|---|
Receiver<TIn> |
Out
Gets the stream to write messages to.
Declaration
public Emitter<TOut> Out { get; }
Property Value
Type | Description |
---|---|
Emitter<TOut> |