Interface ISourceComponent
Interface indicating that a component is a "source" of messages (e.g. sensor inputs, generators, etc.), or otherwise
posts messages from outside a receiver (e.g. from an internal thread or an event handler that is not in response to
incoming messages). Components that implement this interface should advise the pipeline when they are done posting
messages via the notifyCompletionTime
action delegate that is supplied when the pipeline calls the
Start(Action<DateTime>) method. This delegate may be saved and invoked later once the pipeline completion time is known,
or in the case of components that do not have the concept of "completion" (i.e. infinite sources), it may be invoked
immediately with a completion time of
Namespace: Microsoft.Psi.Components
Assembly: Microsoft.Psi.dll
Syntax
public interface ISourceComponent
Methods
View SourceStart(Action<DateTime>)
Called by the pipeline to start the component once all the subscriptions are established.
Declaration
void Start(Action<DateTime> notifyCompletionTime)
Parameters
Type | Name | Description |
---|---|---|
Action<DateTime> | notifyCompletionTime | Delegate to call to notify the pipeline at what time the component will complete. Finite source components
should invoke this delegate, passing in the time at which the component completes after which it will post
no further messages. If this time is not yet known, the component may store a reference to the
|
Stop(DateTime, Action)
Called by the pipeline when shutting down. The component should stop generating new messages once this method completes. However, the component might still receive new messages (if it is subscribed to other components) after this call and is expected to handle them.
Declaration
void Stop(DateTime finalOriginatingTime, Action notifyCompleted)
Parameters
Type | Name | Description |
---|---|---|
DateTime | finalOriginatingTime | The last originating time of any message which may be posted, after which the component should stop posting non-reactive source messages. |
Action | notifyCompleted | Delegate to call to notify the pipeline that the component has completed posting non-reactive source
messages. This delegate should be called once the component has posted its last non-reactive source
message, but only up to (and possibly including) |