LogoLogo
AMPS JavaScript Client 5.3.4
AMPS JavaScript Client 5.3.4
  • Welcome to the AMPS JavaScript Client
    • Before You Start
    • Obtaining and Installing the JavaScript Client
    • Your First AMPS Program
      • Client Identification
      • Connection Strings For AMPS
      • Providing Credentials to AMPS
    • Subscriptions
      • Content Filtering
        • Changing the Filter on a Subscription
      • Understanding Message Objects
      • Promises and Message Handlers
      • Regular Expression Subscriptions
      • Ending Subscriptions
    • Error Handling
      • Disconnect Handling
        • Using a Heartbeat to Detect Disconnection
        • Managing Disconnection
        • Replacing Disconnect Handling
      • Unhandled Errors
    • State of the World
      • SOW and Subscribe
      • Setting Batch Size
      • Managing SOW Contents
    • Using Queues
      • Backlog and Smart Pipelining
      • Acknowledging Messages
      • Acknowledgment Batching
      • Returning a Message to the Queue
      • Manual Acknowledgment
    • Delta Publish and Subscribe
      • Delta Subscribe
      • Delta Publish
    • High Availability
    • AMPS Programming: Working with Commands
    • Message Types
    • Advanced Topics
    • AMPS Server Documentation
    • API Documentation
Powered by GitBook

Get Help

  • FAQ
  • Legacy Documentation
  • Support / Contact Us

Get AMPS

  • Evaluate
  • Develop

60East Resources

  • Website
  • Privacy Policy

Copyright 2013-2024 60East Technologies, Inc.

On this page
Export as PDF
  1. Welcome to the AMPS JavaScript Client
  2. Using Queues

Manual Acknowledgment

To manually acknowledge processed messages and remove the messages from the queue, applications use the sow_delete command with the bookmarks of the messages to remove. Notice that AMPS only supports using a bookmark with sow_delete when removing messages from a queue, not when removing records from a SOW.

For example, given a Message object to acknowledge and a client, the code below acknowledges the message.

const acknowledgeSingle = async (client, message) => {
  return client.execute(
    new Command('sow_delete')
        .topic(message.header.topic())
        .bookmark(message.header.bookmark());
  );
};

In the example above, the program creates a sow_delete command, specifies the topic and the bookmark, and then sends the command to the server.

While this method works, creating and sending an acknowledgment for each individual message can be inefficient if your application is processing a large volume of messages. Rather than acknowledging each message individually, your application can build a comma-delimited list of bookmarks from the processed messages and acknowledge all of the messages at the same time. In this case, it's important to be sure that the number of messages you wait for is less than the maximum backlog -- the number of messages your client can have unacknowledged at a given time. Notice that both automatic acknowledgment and the convenience method Client.ack() take the maximum backlog into account.

PreviousReturning a Message to the QueueNextDelta Publish and Subscribe

Last updated 3 months ago