Skip to content

Delayed Delivery

Publishers can specify the time when the message should be processed and delivered to subscribers. This can be done in addition to all other publishing options (basic publish, with headers. Scheduled messages can be canceled at any time using the message cancellation API.

Non-blocking API

var channel = "TestChannel",
    message = "Hello, world!",
    pubOps = null,
    deliveryOps = new Backendless.DeliveryOptions({
        publishAt: (new Date()).getTime() + 60 * 1000 // 1 minute delay
    });

Backendless.Messaging.publish( channel, message, pubOps, deliveryOps )
 .then( function( response ) {
  })
 .catch( function( error ) {
  });

Blocking API

var channel = "TestChannel",
    message = "Hello, world!",
    pubOps = null,
    deliveryOps = new Backendless.DeliveryOptions({
        publishAt: (new Date()).getTime() + 60 * 1000 // 1 minute delay
    });
var response = Backendless.Messaging.publishSync( channel, message, pubOps, deliveryOps );
// message has been published, message status is available via response.status
// if publish failed - error is described in response.errorMessage