Skip to content

Cancel Scheduled Message

Delayed delivery as well as repeated publish messages can be canceled using the API documented below:

Method

Future<MessageStatus> Backendless.messaging.cancel(String messageId);

where:

Argument                Description
messageId ID of the message to cancel. Message ID must be obtained from the MessageStatus object obtained as the result of the Publish methods.        

Return value

Argument                Description
MessageStatus contains the ID of a message and its status. If the cancellation is successful, the getStatus() method on the MessageStatus object returns the value of PublishStatusEnum.CANCELED).

Errors

The following errors may occur during the message cancellation API call. See the Error Handling section for details on how to retrieve the error code when the server returns an error:

Error Code
Description
5040
Message has already been canceled or does not exist.

Example

String messageId = // message id can be obtained from the MessageStatus object
                // received in the result of the publishing API
Backendless.messaging.cancel(messageId);