Nest module, that checks health of PubSub module
Module uses @nestjs/terminus health-check, and this module intended to be used with it.
Module tries to check if topic exists (by calling exists
function on each passed topic).
Also, you need to grant roles/pubsub.viewer
role to your application, (or any role that contains this),
to access topic info.
Installation:
npm i nestjs-pubsub-health-check
@Module({
imports: [
PubSubHealthCheckModule.forRootAsync({
inject: [PubSubService],
useFactory: (ps: PubSubService) => ({
topics: [ps.topic],
timeout: 5000, // optional
healthCheckKey: 'pubsub' // optional
}),
),
SomeModule,
],
})
export class AppModule {}
And in you HealthCheck module just call
// this.health - HealthCheckService from @nestjs/termius
this.health.check([
async () => this.pubSubHealthCheckModule.pingCheck(),
]);
Bootstrapped with: create-ts-lib-gh
This project is Mit Licensed.