Show / Hide Table of Contents

Class CheckInWorker

Worker for submitting periodic check-ins to the integrations API.

Inheritance
object
CheckInWorker
Implements
IIntegrationSink
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Utils.Unstable.Tasks
Assembly: ExtractorUtils.dll
Syntax
public class CheckInWorker : IIntegrationSink

Constructors

| Edit this page View Source

CheckInWorker(string, ILogger, Client, Action<int>, int?, bool)

Constructor.

Declaration
public CheckInWorker(string integrationId, ILogger logger, Client client, Action<int> onRevisionChanged, int? activeRevision, bool retryStartup = false)
Parameters
Type Name Description
string integrationId

ID of the integration the worker should write to.

ILogger logger

Internal logger.

Client client

Cognite client

Action<int> onRevisionChanged

Callback to call when the remote configuration revision is updated.

int? activeRevision

Currently active config revision. Used to know whether the extractor has received a new config revision since the last check-in. Null indiciates that the extractor is running local config, and should not restart based on changes to remote config.

bool retryStartup

Whether to retry the startup request if it fails, beyond normal retries. If this is true, the check-in worker will retry startup requests indefinitely, instead of raising an exception.

Methods

| Edit this page View Source

Flush(CancellationToken)

Report a check-in immediately, flushing the cache.

This should be called after terminating everything else, to report a final check-in.

Declaration
public Task Flush(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
Task
| Edit this page View Source

QueueActionUpdate(ActionUpdate)

Queue an update to the status of a triggered action, to be sent on a future check-in.

Enforces odin's payload guardrails before queuing: CogniteSdk.Alpha.ActionUpdate.ResultMessage is trimmed of leading/trailing whitespace and truncated to Cognite.Extractor.Utils.Unstable.Tasks.CheckInWorker.MAX_ACTION_RESULT_MESSAGE_LENGTH characters, and CogniteSdk.Alpha.ActionUpdate.ResultMetadata is checked against odin's key count/size and value/total size limits. If either field is oversized, it is reduced and a note is appended to the result message, but CogniteSdk.Alpha.ActionUpdate.Status is left as-is -- an oversized field is reduced and flagged via the note, never treated as a failure.

Declaration
public void QueueActionUpdate(ActionUpdate update)
Parameters
Type Name Description
ActionUpdate update

Update to queue. Must have CogniteSdk.Alpha.ActionUpdate.ExternalId set.

| Edit this page View Source

ReportError(ExtractorError)

Write an error to the sink.

Declaration
public void ReportError(ExtractorError error)
Parameters
Type Name Description
ExtractorError error
| Edit this page View Source

ReportTaskEnd(string, TaskUpdatePayload?, DateTime?)

Report that a task has ended.

Declaration
public 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.

| Edit this page View Source

ReportTaskStart(string, TaskUpdatePayload?, DateTime?)

Report that a task has started.

Declaration
public 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.

| Edit this page View Source

RunPeriodicCheckIn(CancellationToken, StartupRequest, TimeSpan?)

Start running the check-in worker.

This may only be called once.

Declaration
public 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, defaults to 30 seconds.

Returns
Type Description
Task
| Edit this page View Source

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.

Declaration
public 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.

Implements

IIntegrationSink

Extension Methods

DataModelUtils.GetOrCreateResourcesAsync<T, T2>(T2, IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>>, Func<IEnumerable<SourcedNodeWrite<T>>, SanitationMode, (IEnumerable<SourcedNodeWrite<T>>, IEnumerable<CogniteError<SourcedNodeWrite<T>>>)>, int, int, RetryMode, SanitationMode, CancellationToken)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX