Hexagonal, mejora del cliente RMQ y tipos de eventos
This commit is contained in:
21
packages/shared/domain/DomainEvent.ts
Normal file
21
packages/shared/domain/DomainEvent.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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,
|
||||
options: Object,
|
||||
occurredOn: Date,
|
||||
}
|
||||
|
||||
export interface DomainEventSubscriber<T extends DomainEvent> {
|
||||
subscribedTo(): DomainEventType[];
|
||||
getEventNames(): string[];
|
||||
on(domainEvent: T): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user