import type { Schema } from '../../schema/index.js'; import type { ContextBase } from '../types/ContextBase.js'; import type { CustomMessage } from '../types/CustomMessage.js'; import type { Command } from '../types/commandType/Command.js'; import type { CommandDefinition } from '../types/commandType/CommandDefinition.js'; import type { CommandDefinitionListResolved } from '../types/commandType/CommandDefinitionList.js'; import type { EBMessage } from '../types/EBMessage.js'; import type { EBMessageAddress } from '../types/EBMessageAddress.js'; import type { EBMessageSenderAddress } from '../types/EBMessageSenderAddress.js'; import { EBMessageType } from '../types/EBMessageType.enum.js'; import type { EmptyObject } from '../types/EmptyObject.js'; import type { InvokeList } from '../types/InvokeList.js'; import type { InfoMessageType } from '../types/infoType/InfoMessage.js'; import type { Logger } from '../types/Logger.js'; import type { OpenStreamFunction } from '../types/OpenStreamFunction.js'; import type { PrincipalId } from '../types/PrincipalId.js'; import type { QueueContext } from '../types/queue/QueueContext.js'; import type { QueueDefinitionListResolved } from '../types/queue/QueueDefinitionList.js'; import type { QueueInvokeList } from '../types/queue/QueueInvokeList.js'; import type { QueueWorkerDefinitionListResolved } from '../types/queue/QueueWorkerDefinitionList.js'; import type { ServiceClass } from '../types/ServiceClass.js'; import type { ServiceClassTypes } from '../types/ServiceClassTypes.js'; import type { ServiceConstructorInput } from '../types/ServiceConstructorInput.js'; import type { ServiceHealthState } from '../types/ServiceHealthState.js'; import type { InFlightDiagnostics, PausedSubscriptionConsumersByRegistrationKey, QueueWorkerPauseStateByQueue } from '../types/ServiceOperatorState.js'; import { StatusCode } from '../types/StatusCode.enum.js'; import type { StreamInvokeList } from '../types/StreamInvokeList.js'; import type { StreamDefinition } from '../types/stream/StreamDefinition.js'; import type { StreamDefinitionListResolved } from '../types/stream/StreamDefinitionList.js'; import type { StreamMessage } from '../types/stream/StreamMessage.js'; import type { SubscriptionDefinition } from '../types/subscription/SubscriptionDefinition.js'; import type { SubscriptionDefinitionListResolved } from '../types/subscription/SubscriptionDefinitionList.js'; import type { TenantId } from '../types/TenantId.js'; import type { TraceId } from '../types/TraceId.js'; import { ServiceBaseClass } from './ServiceBaseClass/ServiceBaseClass.impl.js'; /** * Base class for all services. * This class provides base functions to work with the event bridge, logging and so on * * Every service should extend this class and should not directly access the eventbridge or other service * * ```typescript * class MyService extends Service { * * async start() { * await super.start() * // your custom implementation * } * * async destroy() { * // your custom implementation * await super.destroy() * } * } * ``` * * @group Service */ export declare class Service = ServiceClassTypes> extends ServiceBaseClass implements ServiceClass { readonly __serviceClassTypes?: S; protected subscriptions: Map>; protected commands: Map>; protected streams: Map>; protected queueDefinitionList: QueueDefinitionListResolved; protected queueWorkerDefinitionList: QueueWorkerDefinitionListResolved; protected activeStreamSessions: Map void>; }>; private queueBridge; private readonly queueDefinitionMap; private queueWorkerTasks; private queueWorkersShouldStop; private queueWorkerPausedQueues; private queueMetricsCache; private queueBridgeStarted; private readonly eventToQueueBindingList; private readonly queueJobStore?; private readonly activeQueueRuntimeCancellations; commandDefinitionList: CommandDefinitionListResolved; subscriptionDefinitionList: SubscriptionDefinitionListResolved; streamDefinitionList: StreamDefinitionListResolved; config: S['ConfigType']; resources: S['Resources']; isStarted: boolean; constructor(config: ServiceConstructorInput); get name(): string; private getServiceMetricAttributes; private getErrorType; private recordFrameworkMetric; private recordDurationMetric; /** * It connects to the event bridge and subscribes to the topics that are in the subscription list. */ start(): Promise; /** * Connect service to event bridge to receive commands and command responses */ protected initializeEventbridgeConnect(commandDefinitionList: CommandDefinitionListResolved, subscriptions: SubscriptionDefinitionListResolved, streams: StreamDefinitionListResolved): Promise; protected initializeQueues(): Promise; /** * Broadcast service info message * @param infoType type of info message * @param target function name is need in messages like InfoServiceFunctionAdded */ protected sendServiceInfo(infoType: InfoMessageType, target?: string, payload?: Record): Promise>; protected getInvokeFunction(serviceTarget: string, traceId?: TraceId, principalId?: PrincipalId, tenantId?: TenantId, invokes?: Invokes): (receiver: EBMessageAddress, invokePayload: Payload, invokeparameter: Parameter, contentType?: string, contentEncoding?: string) => Promise; protected getQueueNamespace(queueInvokes?: QueueInvokeList, traceId?: TraceId, principalId?: PrincipalId, tenantId?: TenantId): { enqueue: import("../index.js").QueueInvokeFunction & import("../index.js").QueueInvokeClientMap; scheduleAt: import("../index.js").QueueScheduleFunction & import("../index.js").QueueScheduleProxy>; }; private createQueueTransformContext; private startLeaseHeartbeat; private applyQueueBeforeExecuteTransform; private resolveDeadLetterQueueName; private validateQueueDefinitionsAgainstCapabilities; private createEventToQueueSubscriptionDefinitions; private getEventToQueueSubscriptionName; private resolveEventToQueueIdempotencyKey; private resolveSubscriptionFailureHandling; private validateSubscriptionAgainstCapabilities; private validateCommandAgainstCapabilities; private validateStreamAgainstCapabilities; private computeRetryDelay; private hasRetryWindowExpired; private shouldPauseQueueWorkerForPoisonMessage; private pauseQueueWorkerForPoisonMessage; private normalizePauseReason; private createQueueIdentityHeaders; private createQueueRuntimeCancellation; private scheduleRetryOrDeadLetter; private deadLetterJob; private getQueueMetricsWithResolvedDeadLetter; private runQueueWorkerBeforeGuards; private runQueueWorkerAfterGuards; private runStreamBeforeGuards; private runStreamAfterGuards; private annotateQueueSpan; private queueSpan; private ackQueueJob; private nackQueueJob; private moveMessageToDeadLetter; private getQueueWorkerParallelism; private evaluateQueueHealth; private enqueueQueue; protected getConsumeStreamFunction(serviceTarget: string, traceId?: TraceId, principalId?: PrincipalId, tenantId?: TenantId, streamInvokes?: StreamInvokes): OpenStreamFunction; protected getEmitFunction = EmptyObject>(serviceTarget: string, traceId?: TraceId, principalId?: PrincipalId, tenantId?: TenantId, emitList?: EmitList): (eventName: K, eventPayload?: Payload, contentType?: string, contentEncoding?: string) => Promise; private recordStoreOperation; getContextFunctions(logger: Logger, queueNamespace?: QueueContext): ContextBase; /** * Called when a command is received by the service * * @param message Command envelope to execute */ executeCommand(message: Readonly): Promise> | { id: import("../index.js").EBMessageId; timestamp: number; contentType: import("../index.js").ContentType; contentEncoding: string; traceId?: TraceId; principalId?: PrincipalId; tenantId?: TenantId; eventName?: string; sender: EBMessageSenderAddress; messageType: EBMessageType.CommandSuccessResponse; correlationId: import("../index.js").CorrelationId; receiver: EBMessageSenderAddress; payload: unknown; otp: string; }>; registerCommand(commandDefinition: CommandDefinition): Promise; protected startQueueWorkers(): void; protected stopQueueWorkers(): Promise; private runQueueWorker; private waitForNextPoll; private createQueueJobContext; private createQueueWorkerAgentInvokeMap; private handleQueueResult; private deliverQueueResult; private createQueueResultEventPayload; private persistQueueResult; private emitQueueResultEvent; private getQueueResultEventId; getServiceHealth(): Promise; private recordQueueSnapshotMetrics; getInFlightDiagnostics(): InFlightDiagnostics; getQueueWorkerPauseState(): QueueWorkerPauseStateByQueue; getPausedSubscriptionConsumerState(): PausedSubscriptionConsumersByRegistrationKey; pauseQueueWorkers(queueName: string, reason?: string): void; resumeQueueWorkers(queueName: string): void; resumeSubscriptionConsumer(registrationKey: string): Promise; executeStream(message: Readonly): Promise; registerStream(streamDefinition: StreamDefinition): Promise; executeSubscription(message: Readonly, subscriptionName: string): Promise | undefined>; registerSubscription(subscriptionDefinition: SubscriptionDefinition): Promise; private normalizeQueueName; private hasQueueFeatures; private getQueueDefinition; private resolveQueueInvokes; destroy(): Promise; } //# sourceMappingURL=Service.impl.d.ts.map