Skip to content

Publish in the Future

The example demonstrates scheduling a message to be delivered on January 1st, 2030 at 00:00 Central time. The message is published into the demo channel:

String channelName = "demo";
DeliveryOptions deliveryOptions = new DeliveryOptions();
Date publishDate = new Date( 1893477600000 ); 
deliveryOptions.setPublishAt( publishDate );

                 "Happy New Year!", 
                 null, // this is null since a PublishOptions object is not provided
                       // see the "Conditional Pub/Sub" section for an example of how
                       // to use the PublishOptions object for this argument
                 new AsyncCallback<MessageStatus>()
  public void handleResponse( MessageStatus status )
    Log.i( "MYAPP", "Message has been published" );

  public void handleFault( BackendlessFault fault )
    Log.e( "MYAPP", "Error processing a message " + fault );
} );