Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.6 KB

scheduling-messages.md

File metadata and controls

37 lines (26 loc) · 1.6 KB

RedisSMQ / Docs / Scheduling Messages

Scheduling Messages

Starting with version 1.0.19, RedisSMQ enables you to schedule a one-time or repeating messages in your MQ server.

To set up scheduling parameters for a given message, the ProducibleMessage Class provides:

You can publish scheduled messages, as any other message, using the Producer.produce() method.

'use strict';
const { ProducibleMessage } = require('redis-smq');

const msg = new ProducibleMessage();
msg
  .setBody({ hello: 'world' })
  .setScheduledCRON(`0 0 * * * *`)
  .setQueue('test_queue');

producer.produce(msg, (err, messageIds) => {
  if (err) console.error(err);
  else console.log('Message has been successfully scheduled. Message IDs are: ', messageIds.join(','));
});

For managing scheduled messages see:

Scheduled messages may be also managed using the HTTP API Interface or from your browser with the help of the Web UI.