Add pg-boss worker poc (#2991)

* Add pg-boss worker poc

* add Example job

* add retry limit

* rename MessageQueue
This commit is contained in:
Weiko
2023-12-14 18:57:25 +01:00
committed by GitHub
parent 468744298b
commit 36164ab59b
18 changed files with 196 additions and 41 deletions

View File

@ -0,0 +1,22 @@
import { Injectable } from '@nestjs/common';
import { MessageQueueJob } from 'src/integrations/message-queue/interfaces/message-queue-job.interface';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
export type FetchMessagesJobData = {
workspaceId: string;
};
@Injectable()
export class FetchMessagesJob implements MessageQueueJob<FetchMessagesJobData> {
constructor(private readonly environmentService: EnvironmentService) {}
async handle(data: FetchMessagesJobData): Promise<void> {
console.log(
`fetching messages for workspace ${
data.workspaceId
} with ${this.environmentService.getMessageQueueDriverType()}`,
);
}
}