Skip to main content

unsubscribe command

The unsubscribe command allows a client to notify AMPS that it no longer wishes to receive messages related to a previous subscription.

There are two ways that a client can unsubscribe from an existing subscription:

  1. Adding the all keyword to the SubId header field in the unsubscribe message will unsubscribe the client from all AMPS SOW topic subscriptions.
  2. With each subscription command issued, AMPS will return a SubId with the processed acknowledgment message. Issuing an unsubscribe command using the same SubId header field which was returned as part of the original subscribe command's processed acknowledgment message will unsubscribe a client from a single subscription.

Header Fields

FieldDescription
cmd

Command to be executed.

Value: unsubscribe

sub_id

Subscription ID entered in AMPS by the client when the original subscription was placed.

AMPS accepts a single subscription ID or a comma-delimited list of subscription ID.

The keyword all can also be used to unsubscribe from all current subscriptions for the client.

When both SubId and QueryId are provided, AMPS removes all matching subscriptions and SOW queries.

This command requires at least one of the SubId or QueryId fields to be set.

query_id

To cancel an in-progress SOW query, the unsubscribe command accepts the Query ID entered in AMPS by the client when the original sow command was placed.

AMPS accepts a single query ID or a comma-delimited list of query IDs.

When both SubId and QueryId are provided, AMPS removes all matching subscriptions and SOW queries.

This command requires at least one of the SubId or QueryId fields to be set.

ack_type

Acknowledgment type for the given command.

Value is a comma separated list of one or more of the following: none, received or persisted.

cmd_idIf specified within an AMPS command requesting an acknowledgment message, all requested acknowledgment messages will contain the CommandId in the ack response header.

Returns

The unsubscribe command supports the received and processed acknowledgment message types, as described in the following table.

AcknowledgmentDescription
noneNo acknowledgment message is returned. This is the default behavior.
completedNot supported at this time.
processedAMPS has processed the unsubscribe message(s).
persistedNot supported at this time.
receivedThe unsubscribe message has been received.
statsNot supported at this time.