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:
-
CommandIdidentifies 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: -
QueryIdis returned on SOW results, and provides theCommandIdof the SOW query command or theQueryIdspecified on the SOW query. For messages returned from asowcommand, only theQueryIdis set on the message. -
SubIdsare returned on messages received from a subscription, and is theCommandIdof the subscribe command that entered the subscription, or theSubIdspecified on the subscribe command. Notice that, when modifying a subscription with thereplaceoption, you use theSubIdof the subscription to tell AMPS which subscription to replace. For messages returned from asow_and_subscribe, theSubIdis set on thegroup_beginandgroup_endmessages and thepublishmessages.
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.