Receiving Only Updated Fields
Last updated
Last updated
Copyright 2013-2024 60East Technologies, Inc.
AMPS allows a subscriber to a Topic
, View
, or ConflatedTopic
in the State-of-the-World to request that the server provide only incremental updates to messages using the sow_and_delta_subscribe
command. This can reduce the size of messages received, and reduce the need to parse or process parts of a message that have not changed when other fields are updated.
When a delta subscription is active, AMPS compares the new state of the message to the old state of the message, creates a message for the difference, and sends the difference message to subscribers.
For example, consider a SOW that contains the following messages, with the order
field as the key of the SOW topic:
Now, consider an update that changes the status of order number 3:
For a regular subscription, subscribers receive the entire message. With a delta subscription, subscribers receive just the key of the SOW topic and any changed fields:
This can significantly reduce the amount of network traffic, and can also simplify processing for subscribers, since the only information sent is the information needed by the subscriber to take action on the message.
When the oof
option is specified on a delta subscription, AMPS will deliver the full message when a previously out-of-focus message comes into focus, even if only some of the fields in the message have changed.
AMPS also supports the ability of a publisher to incrementally update the message, as described in the section on Incremental Message Updates. While these two capabilities work together well, they are completely independent. It is not necessary for a publisher to use delta_publish
for a subscriber to receive incremental updates.
To produce delta messages, the message type and the topic must both support delta subscribe. When this is not the case, AMPS accepts the subscription, but provides full messages rather than delta messages.
All of the basic message types provided with AMPS support delta subscribe with the exception of the binary
message type, struct
message types, and protobuf message types that use protobuf version 3. Composite message types support delta subscribe if they use the composite-local
definition, as described in the section on Composite Message Types.
AMPS queues do not support delta subscribe. AMPS accepts a delta subscription for a queue, but produces full messages from the queue.
Bookmark subscriptions do not support delta subscribe. AMPS does not accept a delta bookmark subscription.
All other AMPS topic types that are based on a SOW support delta subscribe. AMPS topics that do not use a SOW do not support delta subscribe, and instead produce full messages.
When a single connection to AMPS has multiple subscriptions, AMPS sends the message to that client once, with information on the set of subscriptions that match. AMPS sends a message that will include the requested data for all of the matching subscriptions. For example, if a message matches one subscription that requests full messages and another subscription from the same connection that requests deltas, both subscriptions will receive a full message. If your application depends on receiving deltas, take care that the application does not issue non-delta subscriptions for the same set of messages on the same connection.