Background job queue for Gingee apps.
Enqueue work from server scripts; handlers live under
box/jobs/
(or paths mapped in app.json → queue.jobs).
Server: gingee.json → queue (driver memory or redis).
IMPORTANT: Requires the queue permission.- Description:
- Background job queue for Gingee apps.
Enqueue work from server scripts; handlers live under
box/jobs/(or paths mapped inapp.json→queue.jobs). Server:gingee.json→queue(drivermemoryorredis). IMPORTANT: Requires thequeuepermission.
- Background job queue for Gingee apps.
Enqueue work from server scripts; handlers live under
Examples
const queue = require('queue');
await queue.add('send-welcome', { userId: 42 });
// box/jobs/send-welcome.js runs later
// Job handler (box/jobs/send-welcome.js)
module.exports = async function () {
await gingee(async ($g) => {
const { payload, attempt } = $g.queue;
// ...
});
};
Methods
(async, inner) add(name, payloadopt, optionsopt) → {Promise.<{id: string, name: string, appName: string}>}
- Description:
- Enqueue a background job for the current app.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Job name (maps to box/jobs/{name}.js by default) | ||||||||||||||||||||||||||
payload |
* |
<optional> |
JSON-serializable data for the handler ($g.queue.payload) | |||||||||||||||||||||||||
options |
object |
<optional> |
Properties
|
Returns:
- Type
- Promise.<{id: string, name: string, appName: string}>
(inner) getStats() → {object}
- Description:
- Server-side stats (also useful in privileged diagnostics).
Returns:
- Type
- object
(inner) isEnabled() → {boolean}
- Description:
- Whether the server queue is enabled and a driver is running.
Returns:
- Type
- boolean