2026-01-13 15:41:59 +01:00
|
|
|
/**
|
|
|
|
|
* Los eventos de dominion estan orientados a la cola AMQ
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
// Completar con los tipos de evento
|
|
|
|
|
export type DomainEventType = string
|
|
|
|
|
|
|
|
|
|
export type DomainEvent = {
|
|
|
|
|
key: string,
|
|
|
|
|
payload: Object,
|
2026-02-24 11:27:47 +01:00
|
|
|
headers?: Object & {
|
|
|
|
|
message_id?: string
|
|
|
|
|
},
|
|
|
|
|
occurredOn?: Date,
|
2026-01-13 15:41:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DomainEventSubscriber<T extends DomainEvent> {
|
|
|
|
|
subscribedTo(): DomainEventType[];
|
|
|
|
|
getEventNames(): string[];
|
|
|
|
|
on(domainEvent: T): Promise<void>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|