Adding jobs
The most basic operation in BullMQ is adding a job. A job is simply a data structure that has a name, some custom data and options. Jobs are added posting a JSON object to the /queues/:queue-name
endpoint. The endpoint accepts an array of jobs, if sending a standalone job do not forget to wrap it in an array.
Posting jobs is an atomic operation, either all jobs or none will be added to the queue, so if the call fails for any reason, you can be certain that no jobs were added at all.
The JSON object must follow this interface:
Lets add the simplest possible job:
Note how we wrap the job in an array, as we are only sending one job in this example.
The call should succeed and return the complete Job as a Json object with all the defaults as it is stored in BullMQ:
There are obviously many more advanced jobs and features which we will cover in the next pages.
Last updated