subscribe
The subscribe
command is the primary way to retrieve messages from the AMPS processing stream. A client can issue a subscribe
command on a topic to receive all published messages to that topic in the future. Additionally, content filtering can be used to choose which messages the client is interested in receiving.
Header Fields
Field | Description |
| Command to be executed.
Value: |
| Topic to place a subscription against. |
| Acknowledgment type for the given command. Value is a comma separated list of one or more of the following: |
| A bookmark specifying the point in the transaction log at which to start the subscription. If the topic provided is not recorded in a transaction log, AMPS enters the subscription without replaying messages. You can provide a single bookmark, or a comma-delimited list of bookmarks. When a list is provided, AMPS starts the subscription at the earliest bookmark in the list. |
| If specified with an AMPS command requesting an acknowledgment message, all requested acknowledgment messages will contain the |
| A Boolean value ( In the case where the message type is XML, the SOAP envelope will not be included. |
| A CDATA wrapped string, used as a content filter expression. |
| A comma separated list of flags available to the The Options Field table below describes the |
| Boolean ( |
| The subscription ID for this command. When provided with a new subscription, this is the identifier that AMPS will use for the subscription. When provided with the When provided with a For a new subscription, the AMPS clients will generate a subscription ID if one is not provided. |
| The maximum number of messages to provide from a bookmark subscription. This parameter is only valid for replay from the transaction log. This parameter is not valid if no bookmark is provided, if the provided bookmark is |
Options Field
The following table contains a list of the Options
available and their definitions when used in the AMPS subscribe
command.
Option | Description |
| This is the default |
| Specifies that the subscription should return bookmarks, if available, on each publish message. Bookmarks are only available if the topic that is subscribed to is recorded in the transaction log. Notice that this option does not set the starting point for a bookmark subscription: use the This option is not required to receive bookmarks for a bookmark subscription. Those subscriptions always include bookmarks on each publish message. |
| Specifies whether to conflate this subscription.
The value provided can be a time interval, When present and set to a value other than none, enables conflation for the subscription. Can also be set to Recognizes the same time specifiers used in the AMPS configuration file (for example, Default: |
| When conflation is enabled, specifies the fields to use to determine message uniqueness. The format of this option is a comma-delimited list of XPath identifiers within brackets. For example, to conflate based on the value of the
Defaults to the SOW key fields for SOW topics. No default for non-SOW topics. This option is required for non-SOW topics. This option is not valid with the |
| Tells AMPS to send messages to subscribing clients only after they have been persisted to the local transaction log and acknowledged by all downstream instances that use synchronous replication. This option is only valid for bookmark subscriptions. |
| Tells AMPS to send messages to subscribing clients before they have been persisted to the transaction log. This option has no effect on subscriptions that are not replays from the transaction log (that is, this option only applies to bookmark subscriptions). |
| When subscribing to a queue, the number of unacknowledged messages the client is willing to accept at a time. AMPS will not exceed this number, but may choose a smaller number depending on the queue configuration. |
| Specifies that the topic name should be a literal match, even if the topic name contains regular expression characters. |
| Tells AMPS not to send the AMPS-generated |
| Not supported by this command type. |
| Pause a bookmark subscription. This option is only valid for bookmark subscriptions that do not use the |
| Set the maximum message delivery rate for a bookmark subscription. This option is only valid for bookmark subscriptions that do not use the The rate can be specified as either the number of messages per second (for example, |
| When entering a bookmark subscribe that is rate-limited, specify the maximum amount of time that AMPS will wait between messages. |
| Replace the subscription associated with |
| Resume a bookmark subscription. This option is only valid for bookmark subscriptions that do not use the When this option is present, AMPS resumes the subscription or subscriptions provided in the |
| Specifies the fields to include in messages provided on this subscription. The contents of this option are a comma-delimited list of inclusion specifiers. |
| Not supported by this command type. |
| AMPS will include a header with the time at which this instance of AMPS processed the incoming publish command for this message. |
Returns
A subscribe
command returns the following command types:
Command | Description |
| A message published to AMPS. |
| Returned when the |
| Acknowledgments requested, as described in the following section. |
It is possible to specify a processed
acknowledgment be sent back to the client that issued the subscribe
command. Within this processed
acknowledgment, a client can get back the result of placing the subscription (success or failure) and the SubscriptionId
, which uniquely identifies the subscription within AMPS. Keeping track of the SubscriptionId
is useful for unsubscribing from subscriptions and issuing SOW queries.
The following table contains a list of the supported acknowledgment messages available to the subscribe
command.
Acknowledgment | Description |
| No acknowledgment message is returned. This is the default behavior. |
| Used by bookmark subscriptions to identify the point at which replay is completed. When a bookmark is present on the subscribe request and this acknowledgment is requested, AMPS sends a Messages delivered after the |
| AMPS has completed the work necessary to register the subscription. When a bookmark is present and this acknowledgment is requested, this acknowledgment indicates that AMPS is about to begin replay. |
| When a bookmark is present and this acknowledgment is requested, AMPS periodically sends a |
| The |
Errors
Any errors that occur during this command will be returned in the status of a processed
acknowledgment and logged to the log file. Regardless of success or failure, the processed acknowledgment will only be returned if requested by including processed
in the AckType
field.
Last updated