LogoLogo
AMPS Java Client 5.3.4
AMPS Java Client 5.3.4
  • Welcome to the AMPS Java Client
    • Before You Start
    • Obtaining and Installing the AMPS Java Client
    • Your First AMPS Program
      • Client Identification
      • Connection Strings for AMPS
      • Connection Parameters for AMPS
      • Providing Credentials to AMPS
    • Subscriptions
      • Content Filtering
        • Changing the Filter on a Subscription
      • Understanding Message Objects
      • Synchronous Message Processing
      • Asynchronous Message Processing
        • Understanding Threading
      • Regular Expression Subscriptions
      • Ending Subscriptions
    • Error Handling
      • Exceptions
      • Exception Types
      • Exception Handling and Asynchronous Message Processing
      • Controlling Blocking with Command Timeout
      • Disconnect Handling
        • Using a Heartbeat to Detect Disconnection
        • Managing Disconnection
        • Replacing Disconnect Handling
      • Unexpected Messages
      • Unhandled Exceptions
      • Detecting Write Failures
      • Monitoring Connection State
    • State of the World
      • SOW and Subscribe
      • Setting Batch Size
      • Managing SOW Contents
      • Client Side Conflation
    • Using Queues
      • Backlog and Smart Pipelining
      • Acknowledging Messages
      • Acknowledgment Batching
      • Returning a Message to the Queue
      • Manual Acknowledgment
      • Samples of Using a Queue
    • Delta Publish and Subscribe
      • Delta Subscribe
      • Delta Pubilsh
    • High Availability
    • AMPS Programming: Working with Commands
    • Utility Classes
    • Advanced Topics
    • Exceptions Reference
    • 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 Java Client
  2. Subscriptions
  3. Content Filtering

Changing the Filter on a Subscription

AMPS allows you to update parameters, such as the content filter, on a subscription. When you replace a filter on the subscription, AMPS immediately begins sending only messages that match the updated filter. Notice that if the subscription was entered with a command that includes a SOW query, using the replace option can re-issue the SOW query (as described in the AMPS User Guide).

To update the filter on a subscription, you create a subscribe command. You set the SubscriptionId provided on the Command to the identifier of the existing subscription and include the replace option on the Command.

When you send the Command, AMPS atomically replaces the filter and sends messages that match the updated filter from that point forward.

// Assumes client is connected and logged on to AMPS

// Enter subscription

Command subscribe_cmd = new Command("sow_and_subscribe")
    .setTopic("orders-sow")
    .setSubId("A42")   // Used later for replace
    .setFilter("/details/items/description LIKE 'puppy'");

MyHandler mh = new MyHandler();
client.executeAsync(subscribe_cmd, mh);

// ...

// Replace filter elsewhere in the program

Command replace_cmd = new Command("sow_and_subscribe")
    .setTopic("orders-sow")
    .setSubId("A42")   // A42 is the ID of the subscription to replace
    .setFilter("/details/items/description LIKE 'kitten'")
    .setOptions("replace");

client.executeAsync(replace_cmd, mh);
PreviousContent FilteringNextUnderstanding Message Objects

Last updated 3 months ago