Skip to main content

@terascope/job-components / builtin/noop/processor / default

Class: default

Defined in: job-components/src/builtin/noop/processor.ts:4

A variation of "Processor" that deals with a batch of data at a time.

Extends​

Constructors​

Constructor​

new default(context, opConfig, executionConfig): Noop

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

Parameters​

ParameterType
contextContext
opConfigOpConfig
executionConfigExecutionConfig

Returns​

Noop

Inherited from​

default.constructor

Properties​

PropertyModifierTypeInherited fromDefined in
contextreadonlyReadonly<T>default.contextjob-components/src/operations/core/core.ts:10
deadLetterActionpublicstringdefault.deadLetterActionjob-components/src/operations/core/operation-core.ts:23
eventsreadonlyEventEmitterdefault.eventsjob-components/src/operations/core/core.ts:13
executionConfigreadonlyReadonly<ExecutionConfig>default.executionConfigjob-components/src/operations/core/core.ts:11
loggerreadonlyLoggerdefault.loggerjob-components/src/operations/core/core.ts:12
opConfigreadonlyReadonly<OpConfig & T>default.opConfigjob-components/src/operations/core/operation-core.ts:22

Methods​

createAPI()​

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

Defined in: 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: 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()​

handle(input): Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Defined in: job-components/src/operations/batch-processor.ts:15

A generic method called by the Teraslice framework to a give a "Processor" the ability to handle the input and output of operation

Parameters​

ParameterTypeDescription
inputDataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]an array of DataEntities

Returns​

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

an array of DataEntities

Inherited from​

default.handle


initialize()​

initialize(): Promise<void>

Defined in: 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


onBatch()​

onBatch(data): Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Defined in: job-components/src/builtin/noop/processor.ts:5

A method called by BatchProcessor#handle

Parameters​

ParameterType
dataDataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]

Returns​

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

an array of DataEntities

Overrides​

default.onBatch


rejectRecord()​

rejectRecord(input, err): null

Defined in: 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: 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) => R | null

Defined in: 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​

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

(input) => R | null

Inherited from​

default.tryRecord