Next.js Discord

Discord Forum

BullMQ integration

Answered
Cape lion posted this in #help-forum
Open in Discord
Avatar
Cape lionOP
Hey guys! I'm just trying to implement BullMQ into my Next.js App. I have a queues/productQueue.ts which just exports a queue. in a server action, I'll add a job into the queue. Then I have a workers/productWorker.ts which implements the worker. but at the moment, the worker won't "work" and the job is just in the waiting state.

whats the way to go? or should I completely remove workers out of my app and put it into another "queue-worker" project which uses the same redis & postgres database?
Answered by Asian black bear
You can't host something like queues by yourself when using Next, particularly in serverless environments. You need to use a separate stateful backend hosted separately or use a dedicated service that does this for you.
View full answer

3 Replies

Avatar
Asian black bear
You can't host something like queues by yourself when using Next, particularly in serverless environments. You need to use a separate stateful backend hosted separately or use a dedicated service that does this for you.
Answer
Avatar
Asian black bear
Basically Next isn't designed with long running tasks in the background in mind.
Avatar
Cape lionOP
okay, so I will create an external nodejs worker project which handles it? thanks!