@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
73 lines (72 loc) • 3.24 kB
TypeScript
import { BpmnType, EventType, FlowNodeInstanceState, Identity } from '@5minds/processcube_engine_sdk';
import { MessageEventReachedMessageInternal } from '../Contracts/index';
import { FlowNodeInstanceDatabaseAdapter, IdentityService, ProcessDefinitionMediator, ProcessInstanceDatabaseAdapter } from '../Tools';
import { ExecuteProcessService } from './ExecuteProcessService';
import { ProcessTokenService } from './ProcessTokenService';
export type MessagePayload = {
correlationId?: string;
processDefinitionId?: string;
processModelId?: string;
embeddedProcessModelId?: string;
processModelName?: string;
processInstanceId?: string;
parentProcessInstanceId?: string;
flowNodeId?: string;
flowNodeName?: string;
flowNodeType?: BpmnType;
flowNodeInstanceId?: string;
previousFlowNodeInstanceId?: string;
processInstanceOwner?: Identity;
currentToken?: any;
eventType?: EventType;
eventName?: string;
eventId?: string;
identity?: Identity;
triggerValue?: string;
targetProcessInstanceId?: string;
customCorrelationId?: string;
flowNodeInstanceState?: FlowNodeInstanceState;
messageReference: string;
messageChannel?: string;
};
export type TriggerMessageArgs = {
messageReference: string;
identity: Identity;
flowNodeInstanceId?: string;
customCorrelationId?: string;
sourceCorrelationId?: string;
token?: any;
triggerValue?: string;
messageChannel?: string;
};
export declare class MessageEventService {
private readonly executeProcessService;
private readonly flowNodeInstanceAdapter;
private readonly processDefinitionMediator;
private readonly processInstanceAdapter;
private readonly processTokenService;
private readonly logger;
private subscriptions;
private internalSubscriptions;
private deployedMessageCatchEvents;
private internalIdentity;
constructor(executeProcessService: ExecuteProcessService, processDefinitionMediator: ProcessDefinitionMediator, processTokenService: ProcessTokenService, identityService: IdentityService, flowNodeInstanceAdapter: FlowNodeInstanceDatabaseAdapter, processInstanceAdapter: ProcessInstanceDatabaseAdapter);
init(): Promise<void>;
dispose(): void;
throwMessage(data: MessagePayload, awaitAcknowledgement?: boolean): Promise<void>;
throwStartMessage(data: MessagePayload, awaitAcknowledgement?: boolean): Promise<void>;
onMessage(messageReference: string, callback: (message: MessageEventReachedMessageInternal) => void | Promise<void>, subscribeOnce?: boolean, processInstanceId?: string, triggerValue?: string, messageChannel?: string): string;
unsubscribe(subscriptionId: string): void;
acknowledge(eventId: string): void;
private startProcessesWithMessageStartEvent;
private getEventsToStart;
private filterProcessesWithWaitingCatchEvents;
private filterAlreadyStartedProcessInstances;
private parseEventPayloadTriggerValue;
private refreshCatchEventDefinitions;
private getMessageCatchEventDefinitions;
private computeTriggerValuesForMessageReference;
private parseTriggerValueExpressions;
private getCachedEvents;
private distinctTriggerValues;
}