Class ActionContext<TConfig>
Context passed to a custom action's target callback, giving it access to the extractor's configuration and CDF client, information about the specific action invocation it's handling, and the means to report progress and a final result.
Inherited Members
Namespace: Cognite.Extractor.Utils.Unstable.Tasks
Assembly: ExtractorUtils.dll
Syntax
public sealed class ActionContext<TConfig>
Type Parameters
| Name | Description |
|---|---|
| TConfig | Extractor configuration type. |
Properties
| Edit this page View SourceApplicationConfig
The extractor's application configuration.
Declaration
public TConfig ApplicationConfig { get; }
Property Value
| Type | Description |
|---|---|
| TConfig |
CallMetadata
Caller-supplied metadata provided when this action was triggered, if any.
Declaration
public IReadOnlyDictionary<string, string>? CallMetadata { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, string> |
CdfClient
CDF client, if the extractor is configured with one.
Declaration
public CogniteDestination? CdfClient { get; }
Property Value
| Type | Description |
|---|---|
| CogniteDestination |
ExternalId
External ID of this specific action invocation. Used when reporting progress or a final result back via ReportProgress(string)/SetResult(string, IReadOnlyDictionary<string, string>?).
Declaration
public string ExternalId { get; }
Property Value
| Type | Description |
|---|---|
| string |
IntegrationExternalId
External ID of the integration this action was triggered against.
Declaration
public string IntegrationExternalId { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceReportProgress(string)
Report intermediate progress on this action. May be called any number of times, and does not interact with the "call once" guard on SetResult(string, IReadOnlyDictionary<string, string>?).
Unlike SetResult(string, IReadOnlyDictionary<string, string>?), this queues a running-status update immediately --
there is no separate "progress" status on the wire, running is reused for both the
initial pickup acknowledgement and every progress update.
Declaration
public void ReportProgress(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | Human-readable progress message. |
SetResult(string, IReadOnlyDictionary<string, string>?)
Record the final result of this action, to be reported once the target callback returns. May only be called once per action -- this is a deliberate guard, since an action can only have one final result.
This does not itself send anything -- the terminal update is queued by the dispatcher
after the target callback returns without throwing an exception. If the target never
calls this, the dispatcher still reports a terminal succeeded update, just with an
empty result message.
Declaration
public void SetResult(string message, IReadOnlyDictionary<string, string>? metadata = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | Human-readable result message. |
| IReadOnlyDictionary<string, string> | metadata | Optional structured result metadata. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If |
| InvalidOperationException | If called more than once. |