@axinom/mosaic-transactional-inbox-outbox
Version:
This library encapsulates the Mosaic based transactional inbox and outbox pattern
30 lines • 1.7 kB
TypeScript
import { MessagingSettings } from '@axinom/mosaic-message-bus-abstractions';
import { DatabaseClient } from 'pg-transactional-outbox';
import { InboxOutboxLogger, TypedTransactionalMessage } from '../common';
import { TransactionalInboxMessageHandler } from '../inbox';
export interface OutboxInboxHealthCheckMessagingSettings extends MessagingSettings {
messageType: 'OutboxInboxHealthCheckCommand';
queue: 'inbox';
routingKey: string;
action: 'command';
aggregateType: 'service';
}
export declare const getServiceHealthCheckMessagingSettings: (routingKey: string) => OutboxInboxHealthCheckMessagingSettings;
export interface OutboxInboxHealthCheckCommand {
/**
* The unique nonce for the health check request
*/
nonce: string;
}
export declare class OutboxInboxHealthCheckHandler<TConfig> extends TransactionalInboxMessageHandler<OutboxInboxHealthCheckCommand, TConfig> {
/**
* Constructor
* @param messagingSettings The messaging settings - you can use `getServiceHealthCheckMessagingSettings` to create the object
* @param config The service configuration including the serviceId
* @param routingKey The routing key e.g. '<my-service>.health_check'
*/
constructor(messagingSettings: OutboxInboxHealthCheckMessagingSettings, logger: InboxOutboxLogger, config: TConfig);
handleMessage({ payload }: TypedTransactionalMessage<OutboxInboxHealthCheckCommand>, rootClient: DatabaseClient): Promise<void>;
handleErrorMessage(_error: Error, { payload }: TypedTransactionalMessage<OutboxInboxHealthCheckCommand>, rootClient: DatabaseClient): Promise<void>;
}
//# sourceMappingURL=outbox-inbox-health-check-handler.d.ts.map