Cookbook: Subscribe
Last updated
Last updated
Copyright 2013-2024 60East Technologies, Inc.
This section presents common recipes for subscribing to a topic in AMPS using the Command
or Message
interfaces. This section provides information on how to configure the request to AMPS. You can adapt this information to your application and the specific interface you are using.
Command: subscribe
In its simplest form, a subscription needs only the topic to subscribe to.
Header | Comment |
---|---|
In its simplest form, a subscription needs only the topic to subscribe to. To add options to the subscription, set the Options
header on the Command
.
Header | Comment |
---|---|
In its simplest form, a subscription needs only the topic to subscribe to. To use a select list with the subscription, set the Options
header on the Command
to the select list specifier.
Header | Comment |
---|---|
To provide a content filter on a subscription, set the Filter
property on the command. The AMPS User Guide provides details on the filter syntax.
To request conflation on a subscription, set the Options
property on the command to specify the conflation interval. When the topic has a SOW (including a view or a conflated topic), there is no need to provide a conflation_key
.
To request conflation on a subscription, set the Options
property on the command to specify the conflation interval. When the topic does not have a SOW, you must provide a conflation_key
.
To create a bookmark subscription, set the Bookmark
property on the command. The value of this property can be either a specific bookmark, a timestamp, or one of the client-provided constants. The AMPS User Guide provides details on creating timestamps. Notice that the MOST_RECENT
constant tells the AMPS client to find the appropriate message in the client bookmark store and begin the subscription at that point. In this case, the client sends that bookmark value to AMPS. The Bookmark
option is only supported for topics that are recorded in an AMPS transaction log.
To create a bookmark subscription, set the Bookmark
property on the command. The value of this property can be either a specific bookmark, a timestamp, or one of the client-provided constants. The AMPS User Guide provides details on creating timestamps. Notice that the MOST_RECENT
constant tells the AMPS client to find the appropriate message in the client bookmark store and begin the subscription at that point. In this case, the client sends that bookmark value to AMPS. The Bookmark
option is only supported for topics that are recorded in an AMPS transaction log.
To manage the message delivery rate to a bookmark subscription, set the rate
option specifying the rate at which to replay messages.
To create a bookmark subscription, set the Bookmark
property on the command. The value of this property can be either a specific bookmark, a timestamp, or one of the client-provided constants. The AMPS User Guide provides details on creating timestamps. Notice that the MOST_RECENT
constant tells the AMPS client to find the appropriate message in the client bookmark store and begin the subscription at that point. In this case, the client sends that bookmark value to AMPS. The Bookmark
option is only supported for topics that are recorded in an AMPS transaction log.
The rate
option specifies the rate at which to replay messages, while the rate_max_gap
option specifies the maximum amount of time for AMPS to allow between messages.
To create a bookmark subscription, set the Bookmark
property on the command. The value of this property can be either a specific bookmark, a timestamp, or one of the client-provided constants. The AMPS User Guide provides details on creating timestamps. Notice that the MOST_RECENT
constant tells the AMPS client to find the appropriate message in the client bookmark store and begin the subscription at that point. In this case, the client sends that bookmark value to AMPS. The Bookmark
option is only supported for topics that are recorded in an AMPS transaction log.
To receive acknowledgment messages to a bookmark subscription, set the AckType
on the command specifying the type of acknowledgments to receive. In this case, be sure to include the completed
type.
To create a bookmark subscription, set the Bookmark
property on the command. The property can be either a specific bookmark, a timestamp, or one of the client-provided constants. The AMPS User Guide provides details on creating timestamps. Notice that the MOST_RECENT
constant tells the AMPS client to find the appropriate message in the client bookmark store and begin the subscription at that point. In this case, the client sends that bookmark value to AMPS.
To add a filter to a bookmark subscription, set the Filter
property on the command. The AMPS User Guide provides details on the filter syntax.
To pause a bookmark subscription, you must provide the subscription ID and the pause
option on a subscribe
command.
To resume a bookmark subscription, you must provide the subscription ID and the resume
option on a subscribe
command.
To replace the content filter on a subscription, provide the SubId
of the subscription to be replaced, add the replace
option, and set the Filter
property on the command with the new filter. The AMPS User Guide provides details on the filter syntax.
To subscribe to a queue and request a max_backlog
greater than 1
, use the Options
field of the subscribe
command to set the requested max_backlog
.
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|
Header | Comment |
---|---|