diff --git a/example/bee.js b/example/bee.js index 5df3de74..2d0de3e2 100644 --- a/example/bee.js +++ b/example/bee.js @@ -12,6 +12,23 @@ async function main() { const server = new RedisServer(REDIS_SERVER_PORT); await server.open(); + const queue = new Bee('name_of_my_queue', { + redis: { + port: REDIS_SERVER_PORT, + }, + }); + + // Fake process function to move newly created jobs in the UI through a few of the job states. + queue.process(async function (job) { + // Wait 5sec + await new Promise((res) => setTimeout(res, 5000)); + + // Randomly succeeds or fails the job to put some jobs in completed and some in failed. + if (Math.random() > 0.5) { + throw new Error('fake error'); + } + }); + Arena( { Bee,