What's the difference between CommandId, QueryId, and SubId?
A simple way to look at the differences is that clients submit a CommandId
with their commands. AMPS then uses that CommandId
when it needs to refer to the command later on.
Here's a quick breakdown from the point of view of the AMPS server:
CommandId
identifies a specific command. Clients provide this on commands to AMPS, and AMPS returns it in the ack messages for that command. The CommandId is also provided on the query results and subscription results to indicate the command that ran the query and/or registered the subscription, as follows:QueryId
is returned on SOW results, and provides theCommandId
of the SOW query command or theQueryId
specified on the SOW query. For messages returned from asow
command, only theQueryId
is set on the message.SubIds
are returned on messages received from a subscription, and is theCommandId
of the subscribe command that entered the subscription, or theSubId
specified on the subscribe command. Notice that, when modifying a subscription with thereplace
option, you use theSubId
of the subscription to tell AMPS which subscription to replace. For messages returned from asow_and_subscribe
, theSubId
is set on thegroup_begin
andgroup_end
messages and thepublish
messages.
The AMPS clients fill in a CommandId
where necessary if one is not provided, and return that CommandId
for use in correlating later messages to and from AMPS.
In the AMPS HAClients, bookmark subscribe commands use a SubId
to locate and resume subscriptions: in this case, to correctly resume a subscription, the AMPS HAClient interfaces request that the application provide a SubId
. The client then uses that SubId
to resume the subscription as necessary, and handles populating the CommandId
properly for a bookmark subscribe.
We document these header fields in more detail in the AMPS Command Reference, available from the 60East website.
Last updated