Interface IIntegrationSink
Interface for types that can consume errors and write them to some sink (integrations API).
Namespace: Cognite.Extractor.Utils.Unstable.Tasks
Assembly: ExtractorUtils.dll
Syntax
public interface IIntegrationSink
Methods
| Edit this page View SourceFlush(CancellationToken)
Flush the sink, ensuring all errors and tasks are written.
Declaration
Task Flush(CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token |
Returns
| Type | Description |
|---|---|
| Task |
QueueActionUpdate(ActionUpdate)
Queue an update to the status of a triggered action, to be sent on a future check-in.
Declaration
void QueueActionUpdate(ActionUpdate update)
Parameters
| Type | Name | Description |
|---|---|---|
| ActionUpdate | update | Update to queue. Must have CogniteSdk.Alpha.ActionUpdate.ExternalId set. |
ReportError(ExtractorError)
Write an error to the sink.
Declaration
void ReportError(ExtractorError error)
Parameters
| Type | Name | Description |
|---|---|---|
| ExtractorError | error |
ReportTaskEnd(string, TaskUpdatePayload?, DateTime?)
Report that a task has ended.
Declaration
void ReportTaskEnd(string taskName, TaskUpdatePayload? update = null, DateTime? timestamp = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | taskName | Name of task that ended. |
| TaskUpdatePayload | update | Content of the task update. |
| DateTime? | timestamp | When the task ended, defaults to current time. |
ReportTaskStart(string, TaskUpdatePayload?, DateTime?)
Report that a task has started.
Declaration
void ReportTaskStart(string taskName, TaskUpdatePayload? update = null, DateTime? timestamp = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | taskName | Name of task that started. |
| TaskUpdatePayload | update | Content of the task update. |
| DateTime? | timestamp | When the task started, defaults to current time. |
RunPeriodicCheckIn(CancellationToken, StartupRequest, TimeSpan?)
Run the sink, automatically flushing at regular intervals.
Declaration
Task RunPeriodicCheckIn(CancellationToken token, StartupRequest startupPayload, TimeSpan? interval = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | Cancellation token. |
| StartupRequest | startupPayload | Payload to send to the startup endpoint before beginning to report periodic check-ins. |
| TimeSpan? | interval | Interval. If left out, uses an implementation-defined default. |
Returns
| Type | Description |
|---|---|
| Task |
SetActionDispatcher(Func<IReadOnlyList<IntegrationAction>, Task>)
Register the callback to invoke whenever a check-in or startup response contains one or more actions pending execution by the extractor.
The dispatcher is expected to return promptly -- it should hand off actual execution (e.g. to one Run(Action) per action) rather than running actions to completion itself, since it is awaited as part of the regular check-in cycle.
Declaration
void SetActionDispatcher(Func<IReadOnlyList<IntegrationAction>, Task> dispatcher)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IReadOnlyList<IntegrationAction>, Task> | dispatcher | Callback invoked with the current list of pending actions. |