2023-08-23 21:44:59 -04:00
|
|
|
export enum MessageType {
|
2023-08-25 18:48:17 -04:00
|
|
|
NEW_ENTITIES = 'NEW_ENTITIES',
|
|
|
|
REMOVE_ENTITIES = 'REMOVE_ENTITIES',
|
|
|
|
UPDATE_ENTITY = 'UPDATE_ENTITY'
|
2023-08-23 21:44:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export type EntityAddBody = {
|
|
|
|
entityName: string;
|
|
|
|
args: any;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Message = {
|
|
|
|
type: MessageType;
|
|
|
|
body: any;
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface MessageQueueProvider {
|
|
|
|
getNewMessages(): Message[];
|
|
|
|
clearMessages(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MessagePublisher {
|
|
|
|
addMessage(message: Message): void;
|
|
|
|
publish(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MessageProcessor {
|
|
|
|
process(message: Message): void;
|
|
|
|
}
|