TwentyT
Twenty2y ago
17 replies
rush

need help with creating message-queue tasks.

Hello, it is an awesome product and I want to start by thanking you guys for making it opensource. I am trying to add a feature and I've built it raw, without integrating message-queue functionality into it. A little description- my feature uses langchain; it takes the required data and enriches it with more information (through an LLM). Now since I am sendiing many records, and aim to use it for more than 1 users at a time, I want to integrate it with message queues. The documentation doesn't seem to be helping me. I am a bit new to the development space also. I'll be grateful if you point me in the right direction. I have tried to look through and understand how the gmail and calendar sync is happening but doesn't seem to help by developing-with-reference technique for my use-case.

So, this is the controller that is taking the arguments and working to enrich the data:
@Controller('gpt-api')
export class GPTAPIController {
  constructor(
    private gptAPIService: GPTAPIService,
  ) {}

    @Get()
    findAll(): string {
      return 'This action returns all cats';
    }
  
    @Post('enrichment')
    get(@Req() req): object {
      return this.gptAPIService.enrichData(req.body.options, req.body.rawData);
    }
  
    @Post('process-cv')
    async getCVProcess(): Promise<object> {
      const cvProcessingService = new CVProcessing(
        '/path/to/file.pdf',
      );
  
      return await cvProcessingService.getScoresFromCustomPrompt(
        questions,
        // req.body.field_names,
      );
    }
  
    @Post('putting')
    put() {}
}



I want to integrate message queues such that when I send multiple CVs (or through multiple users at once) it adds to the message queue and then executes them one at a time. I am using Bull-MQ and Redis. I can provide more context if you want. I would appreciate any help.
Was this page helpful?