Returning a Message to the Queue

A subscriber can also explicitly release a message back to the queue. AMPS returns the message to the queue, and redelivers the message just as though the lease had expired. To do this, the subscriber sends a sow_delete command with the bookmark of the message to release and the cancel option.

client.execute(
  new Command('sow_delete')
      .topic(message.header.topic())
      .bookmark(message.header.bookmark())
      .options('cancel');
);

When using automatic acknowledgments, AMPS will cancel a message if an exception is thrown from the message handler.

Last updated