Lu
Lu2y ago

BullMQ + TRPC

Curious how to configure BullMQ with TRPC correctly. Currently I have the queue, queueevents, and the worker inside a router. Though it works, I have a feeling its not the right approach?
3 Replies
Dani;
Dani;2y ago
I don't think you should have those in a router. BullMQ should be defined outside of tRPC, then you'll be able to queue new jobs from your tRPC routers
Lu
LuOP2y ago
Ya, I actually moved BullMQ into its own node sever. Rather not have long-lasting processes like this in a NextJS app
Dani;
Dani;2y ago
Fair enough, i mean you can have it in the same node process using a custom nextjs server, you just can’t go serverless if you do that