Class ExtractorRunner
Contains utilities for running an extractor based on BaseExtractor
Inherited Members
Namespace: Cognite.Extractor.Utils
Assembly: ExtractorUtils.dll
Syntax
public static class ExtractorRunner
Methods
| Edit this page View SourceRun<TConfig, TExtractor>(ExtractorRunnerParams<TConfig, TExtractor>, CancellationToken)
Configure and run an extractor with config of type TConfig
and extractor of type TExtractor
Declaration
public static Task Run<TConfig, TExtractor>(ExtractorRunnerParams<TConfig, TExtractor> options, CancellationToken token) where TConfig : VersionedConfig where TExtractor : BaseExtractor<TConfig>
Parameters
Type | Name | Description |
---|---|---|
ExtractorRunnerParams<TConfig, TExtractor> | options | Parameter object |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
TConfig | Type of configuration |
TExtractor | Type of extractor |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If options is not set |
Run<TConfig, TExtractor>(string, int[], string, string, bool, bool, bool, bool, CancellationToken, Action<CogniteDestination?, TExtractor>?, Action<TConfig, ExtractorRunnerParams<TConfig, TExtractor>, ServiceCollection>?, ServiceCollection?, ILogger?, TConfig?, bool, Action<ILogger, Exception, string>?, bool)
Configure and run an extractor with config of type TConfig
and extractor of type TExtractor
Declaration
public static Task Run<TConfig, TExtractor>(string configPath, int[] acceptedConfigVersions, string appId, string userAgent, bool addStateStore, bool addLogger, bool addMetrics, bool restart, CancellationToken token, Action<CogniteDestination?, TExtractor>? onCreateExtractor = null, Action<TConfig, ExtractorRunnerParams<TConfig, TExtractor>, ServiceCollection>? configCallback = null, ServiceCollection? extServices = null, ILogger? startupLogger = null, TConfig? config = null, bool requireDestination = true, Action<ILogger, Exception, string>? logException = null, bool allowRemoteConfig = true) where TConfig : VersionedConfig where TExtractor : BaseExtractor<TConfig>
Parameters
Type | Name | Description |
---|---|---|
string | configPath | Path to yml config file. Can be null to not load config, in this case
|
int[] | acceptedConfigVersions | List of accepted config versions, null accepts all |
string | appId | AppId to append to requests to CDF |
string | userAgent | User agent on form Product/Version |
bool | addStateStore | True if the extractor uses a state store |
bool | addLogger | True to add logging |
bool | addMetrics | True to add metrics |
bool | restart | True to restart extractor if it crashes or terminates, using exponential backoff |
CancellationToken | token | Optional cancellation token from external cancellation source |
Action<CogniteDestination, TExtractor> | onCreateExtractor | Method called when the extractor is created, used to retrieve the extractor and destination objects |
Action<TConfig, ExtractorRunnerParams<TConfig, TExtractor>, ServiceCollection> | configCallback | Called after config has been created, used to manually set config parameters, for example from command line options. Can also throw a ConfigurationException if the contents are invalid |
ServiceCollection | extServices | Optional pre-configured service collection |
ILogger | startupLogger | Optional logger to use before config has been loaded, to report configuration issues |
TConfig | config | Optional pre-existing config object, can be used instead of config path. |
bool | requireDestination | Default true, whether to fail if a destination cannot be configured |
Action<ILogger, Exception, string> | logException | Method called to log exceptions. Useful if special handling is desired. |
bool | allowRemoteConfig | True to allow the user to specify "type: remote", and get config read from extraction pipelines. |
Returns
Type | Description |
---|---|
Task | Task which completes when the extractor has run |
Type Parameters
Name | Description |
---|---|
TConfig | Type of configuration |
TExtractor | Type of extractor |