Currently, I am working on a NestJS project with the bull queue. In my controller, I have a get function to receive the request from the front end. Based on the request, I will send a gRPC call to retrieve data from other microservice. I would like to let the gRPC call function work with the bull queue. So, in the get function, I put the gRPC call function into producer, which can be executed in the consumer. However, after the gRPC call function is executed in the consumer, I can not find a way to return the retrieved data to the previous get function so that I can send the data back to the front end.
Any help would be appreciated.
You won't be able, the main purpose of using queues is non-blockage of any incoming request.
What you can do is, returning the job id of bull queue and then the front-end dev can track the response on it, or maybe use some event-driven approaches or websocket so you can tell him to refresh the resposne for it