Skip to main content

QCommunicationEngine

@quik/communication


@quik/communication / QCommunicationEngine

Abstract Class: QCommunicationEngine<MessageDefinition>

Defined in: communication/src/engine.ts:14

Base class for communication engines such as email or SMS. It wraps the send logic with an enabled check and exposes configuration helpers.

Extends

  • QObject

Extended by

Type Parameters

MessageDefinition

MessageDefinition = ObjectLiteral

Shape of the message handled by the engine.

Constructors

Constructor

new QCommunicationEngine<MessageDefinition>(): QCommunicationEngine<MessageDefinition>

Returns

QCommunicationEngine<MessageDefinition>

Inherited from

QObject.constructor

Accessors

defaultFrom

Get Signature

get defaultFrom(): string

Defined in: communication/src/engine.ts:21

Default address used when no sender is provided.

Returns

string


engineType

Get Signature

get abstract protected engineType(): string

Defined in: communication/src/engine.ts:26

Engine identifier used for configuration lookups.

Returns

string


isEnabled

Get Signature

get isEnabled(): boolean

Defined in: communication/src/engine.ts:16

Indicates whether the engine is enabled.

Returns

boolean


logger

Get Signature

get protected logger(): IQLogger

Defined in: core/src/QObject.ts:15

The logger getter for the object.

Returns

IQLogger

Inherited from

QObject.logger


name

Get Signature

get name(): string

Defined in: core/src/QObject.ts:8

Returns

string

Inherited from

QObject.name


retryAttempts

Get Signature

get protected retryAttempts(): number

Defined in: communication/src/engine.ts:110

Number of retry attempts for provider calls.

Returns

number


retryBackoffFactor

Get Signature

get protected retryBackoffFactor(): number

Defined in: communication/src/engine.ts:122

Backoff factor applied to the retry delay.

Returns

number


retryDelayMilliseconds

Get Signature

get protected retryDelayMilliseconds(): number

Defined in: communication/src/engine.ts:116

Base delay between retries in milliseconds.

Returns

number


timeoutMilliseconds

Get Signature

get protected timeoutMilliseconds(): number

Defined in: communication/src/engine.ts:105

Timeout for provider calls in milliseconds. Use 0 to disable.

Returns

number

Methods

_send()

abstract protected _send(message): Promise<void>

Defined in: communication/src/engine.ts:102

Implementation specific send logic.

Parameters

message

MessageDefinition

Message definition to send.

Returns

Promise<void>


endSpan()

protected endSpan(span): void

Defined in: core/src/QObject.ts:35

End a span returned by startSpan.

Parameters

span

TelemetrySpan

The span to end.

Returns

void

Inherited from

QObject.endSpan


recordSpanError()

protected recordSpanError(span, err): void

Defined in: core/src/QObject.ts:45

Record an exception on an active span.

Parameters

span

TelemetrySpan

The span to record the error on.

err

unknown

The error to record.

Returns

void

Inherited from

QObject.recordSpanError


send()

send(message): Promise<void>

Defined in: communication/src/engine.ts:33

Dispatches a message if the engine is enabled.

Parameters

message

MessageDefinition

Message definition to send.

Returns

Promise<void>


setSpanAttribute()

protected setSpanAttribute(span, key, value): void

Defined in: core/src/QObject.ts:64

Set a single attribute on an active span.

Parameters

span

TelemetrySpan

The span to update.

key

string

Attribute key.

value

string | number | boolean

Attribute value.

Returns

void

Inherited from

QObject.setSpanAttribute


sleep()

protected sleep(delayMs): Promise<void>

Defined in: communication/src/engine.ts:150

Sleep helper for retry delays.

Parameters

delayMs

number

Returns

Promise<void>


startSpan()

protected startSpan(spanName, options?): TelemetrySpan

Defined in: core/src/QObject.ts:26

Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.

Parameters

spanName

string

Name of the span.

options?

TelemetrySpanOptions

Optional span attributes and kind.

Returns

TelemetrySpan

Inherited from

QObject.startSpan


withTimeout()

protected withTimeout<T>(task, timeoutMs): Promise<T>

Defined in: communication/src/engine.ts:128

Applies a timeout to a provider call when configured.

Type Parameters

T

T

Parameters

task

Promise<T>

timeoutMs

number

Returns

Promise<T>