Skip to main content

@terascope/job-components / operations/core/fetcher-core / default

Class: abstract default<T>

Defined in: packages/job-components/src/operations/core/fetcher-core.ts:11

A base class for supporting "Fetcher" that run on a "Worker". The "Fetcher" is a part of the "Reader" component of a job. See [[OperationCore]]

Extends

Extended by

Type Parameters

Type ParameterDefault type
TOpConfig

Constructors

new default()

new default<T>(context, opConfig, executionConfig): default<T>

Defined in: packages/job-components/src/operations/core/operation-core.ts:26

Parameters

ParameterType
contextContext
opConfigOpConfig & T
executionConfigExecutionConfig

Returns

default<T>

Inherited from

default.constructor

Properties

PropertyModifierTypeInherited fromDefined in
contextreadonlyReadonly<Context>default.contextpackages/job-components/src/operations/core/core.ts:10
deadLetterActionpublicstringdefault.deadLetterActionpackages/job-components/src/operations/core/operation-core.ts:24
eventsreadonlyEventEmitterdefault.eventspackages/job-components/src/operations/core/core.ts:13
executionConfigreadonlyReadonly<ExecutionConfig>default.executionConfigpackages/job-components/src/operations/core/core.ts:11
loggerreadonlyLoggerdefault.loggerpackages/job-components/src/operations/core/core.ts:12
opConfigreadonlyReadonly<OpConfig & T>default.opConfigpackages/job-components/src/operations/core/operation-core.ts:23

Methods

createAPI()

createAPI<A>(name, ...params): Promise<A>

Defined in: packages/job-components/src/operations/core/operation-core.ts:47

Create an API and add it to the operation lifecycle

Type Parameters

Type ParameterDefault type
A extends OpAPIOpAPI

Parameters

ParameterType
namestring
...paramsany[]

Returns

Promise<A>

Inherited from

default.createAPI


getAPI()

getAPI<A>(name): A

Defined in: packages/job-components/src/operations/core/operation-core.ts:54

Get a reference to an existing API

Type Parameters

Type ParameterDefault type
A extends OpAPIOpAPI

Parameters

ParameterType
namestring

Returns

A

Inherited from

default.getAPI


handle()

abstract handle(sliceRequest?): Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Defined in: packages/job-components/src/operations/core/fetcher-core.ts:16

A generic method called by the Teraslice framework to a give a "Fetcher" the ability to handle the fetch operation

Parameters

ParameterType
sliceRequest?unknown

Returns

Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>


initialize()

initialize(): Promise<void>

Defined in: packages/job-components/src/operations/core/operation-core.ts:36

Called during execution initialization, when this is called perform any async setup.

Returns

Promise<void>

Inherited from

default.initialize


rejectRecord()

rejectRecord(input, err): null

Defined in: packages/job-components/src/operations/core/operation-core.ts:92

Reject a record using the dead letter action

Based on OpConfig._dead_letter_action the transformation can be handled any of the following ways:

  • "throw": throw the original error
  • "log": log the error and the data
  • "none": skip the error entirely OR a string to specify the api to use as the dead letter queue

Parameters

ParameterType
inputunknown
errError

Returns

null

null

Inherited from

default.rejectRecord


shutdown()

shutdown(): Promise<void>

Defined in: packages/job-components/src/operations/core/operation-core.ts:40

Called during execution shutdown, when this is cleanup any open connections or destroy any in-memory state.

Returns

Promise<void>

Inherited from

default.shutdown


tryRecord()

tryRecord<I, R>(fn): (input) => null | R

Defined in: packages/job-components/src/operations/core/operation-core.ts:67

Try catch a transformation on a record and place any failed records in a dead letter queue

See #rejectRecord for handling

Type Parameters

Type Parameter
I
R

Parameters

ParameterTypeDescription
fn(input) => Ra function to transform the data with

Returns

Function

a curried a function that will be called with the data and handle the dead letter action

Parameters
ParameterType
inputI
Returns

null | R

Inherited from

default.tryRecord