1.6.0 • Published 2 years ago

@casestack/queueball v1.6.0

Weekly downloads
21
License
UNLICENSED
Repository
github
Last release
2 years ago

Queueball

A simple RabbitMQ-based work queue

Example

const { Consumer, Producer } = require('@casestack/queueball');

const config = {
  rabbitmqUrl: 'amqp://guest:guest@localhost:5672',
  name: 'example',
};

async function example() {
  const producer = new Producer(config);
  const consumer = new Consumer(config);

  await Promise.all([producer.start(), consumer.start()]);

  consumer.processJob = job => console.log(job.payload.exampleKey);
  producer.enqueue({ exampleKey: 'example' });
}

example();

Connection Issues

If the producer or consumer cannot initially connect, the start() method will throw an error. Once an initial connection is established, you can use the isConnected() method to check on the status.

This is more set up to work alongside /health checks, but may in the future be extended to emit events when a connection issue happens. A simple workaround for retries would just be use setInterval and, if isConnected() returns false, attempt to call start() again.

1.6.0

2 years ago

1.5.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.3

3 years ago

0.2.6

3 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago