import { ExternalTaskReusableError } from '../../DataModels/ExternalTask/index'; import { EventMessage } from './BaseMessage'; /** * @swagger * components: * schemas: * ExternalTaskCreatedMessage: * description: Message that is sent whenever an ExternalTask encountered an error. * allOf: * - $ref: '#/components/schemas/EventMessage' * - type: object * required: * - externalTaskId * - topic * - isSingleTry * properties: * externalTaskId: * description: The ID of the ExternalTask. * type: string * topic: * description: The topic of the ExternalTask. * type: string * isSingleTry: * description: Flag indicating whether the ExternalTask is a SingleTry ExternalTask. * type: boolean */ /** * Encapsulates the message that is sent when when an ExternalTask was created. */ export type ExternalTaskCreatedMessage = EventMessage & { externalTaskId: string; topic: string; isSingleTry: boolean; }; /** * @swagger * components: * schemas: * ExternalTaskLockedMessage: * description: Message that is sent whenever an ExternalTask was locked by a worker. * allOf: * - $ref: '#/components/schemas/ExternalTaskCreatedMessage' * - type: object * required: * - workerId * - lockExpirationTime * properties: * workerId: * description: The ID of the worker that locked the ExternalTask. * type: string * lockExpirationTime: * description: The time when the lock expires. * type: string */ /** * Encapsulates the message that is sent when when a batch of ExternalTasks was locked by a worker. */ export type ExternalTaskLockedMessage = ExternalTaskCreatedMessage & { workerId: string; lockExpirationTime: Date; }; /** * @swagger * components: * schemas: * ExternalTaskUnlockedMessage: * description: Message that is sent whenever an ExternalTask lock expires. * allOf: * - $ref: '#/components/schemas/ExternalTaskCreatedMessage' * - type: object * required: * - externalTaskId * - topic * properties: * externalTaskId: * description: The ID of the ExternalTask. * type: string * topic: * description: The topic of the ExternalTask. * type: string */ /** * Encapsulates the message that is sent when when an ExternalTask lock expires. * Only sent for Multi-Try External Tasks, because SingleTry External Tasks will emit an ExternalTaskExpired message in such cases. */ export type ExternalTaskUnlockedMessage = ExternalTaskCreatedMessage & { externalTaskId: string; topic: string; }; /** * @swagger * components: * schemas: * ExternalTaskExpiredMessage: * description: Message that is sent whenever an ExternalTask expires. * allOf: * - $ref: '#/components/schemas/ExternalTaskCreatedMessage' * - type: object * required: * - externalTaskId * - topic * properties: * externalTaskId: * description: The ID of the ExternalTask. * type: string * topic: * description: The topic of the ExternalTask. * type: string */ /** * Encapsulates the message that is sent when when an SingleTry ExternalTask expires. */ export type ExternalTaskExpiredMessage = ExternalTaskCreatedMessage & { externalTaskId: string; topic: string; }; /** * @swagger * components: * schemas: * ExternalTaskErrorMessage: * description: Message that is sent whenever an ExternalTask encountered an error. * allOf: * - $ref: '#/components/schemas/ExternalTaskCreatedMessage' * - type: object * required: * - error * properties: * error: * description: The error that occurred. * $ref: '#/components/schemas/ExternalTaskReusableError' */ /** * Encapsulates a payload that is used when sending an event for finishing an External Task with an error result. */ export type ExternalTaskErrorMessage = { error: ExternalTaskReusableError; }; /** * @swagger * components: * schemas: * ExternalTaskSuccessMessage: * description: Message that is sent whenever an ExternalTask encountered an error. * allOf: * - $ref: '#/components/schemas/ExternalTaskCreatedMessage' * - type: object * required: * - result * properties: * result: * description: The result of the ExternalTask. * type: object */ /** * Encapsulates a payload that is used when sending an event for finishing an External Task with a success result. */ export type ExternalTaskSuccessMessage = { result: TResult; };