Persistent Subscriptions This document explains how to use HTTP API for setting up and consuming persistent subscriptions and competing consumer subscription groups. For an overview on competing consumers and how they relate to other subscription types please see our getting started guide .
TIP
The Administration UI includes a Competing Consumers section where you are able to create, update, delete and view subscriptions and their statuses.
Creating a Persistent Subscription Before interacting with a subscription group, you need to create one. You receive an error if you try to create a subscription group more than once. This requires admin permissions .
URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}
application/json
PUT
Query Parameters Parameter Description stream
The stream the persistent subscription is on. subscription_name
The name of the subscription group.
Body Parameter Description resolveLinktos
Tells the subscription to resolve link events. startFrom
Start the subscription from the position-of the event in the stream. extraStatistics
Tells the backend to measure timings on the clients so statistics will contain histograms of them. checkPointAfterMilliseconds
The amount of time the system should try to checkpoint after. liveBufferSize
The size of the live buffer (in memory) before resorting to paging. readBatchSize
The size of the read batch when in paging mode. bufferSize
The number of messages that should be buffered when in paging mode. maxCheckPointCount
The maximum number of messages not checkpointed before forcing a checkpoint. maxRetryCount
Sets the number of times a message should be retried before considered a bad message. maxSubscriberCount
Sets the maximum number of allowed TCP subscribers. messageTimeoutMilliseconds
Sets the timeout for a client before the message will be retried. minCheckPointCount
The minimum number of messages to write a checkpoint for. namedConsumerStrategy
RoundRobin/DispatchToSingle/Pinned
Updating a Persistent Subscription You can edit the settings of an existing subscription while it is running. This drops the current subscribers and resets the subscription internally. This requires admin permissions.
URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}
application/json
POST
Query Parameters Parameter Description stream
The stream to the persistent subscription is on. subscription_name
The name of the subscription group.
Body Same parameters as "Creating a Persistent Subscription"
Deleting a Persistent Subscription URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}
application/json
DELETE
Query Parameters Parameter Description stream
The stream to the persistent subscription is on. subscription_name
The name of the subscription group.
Reading a stream via a Persistent Subscription By default, reading a stream via a persistent subscription returns a single event per request and does not embed the event properties as part of the response.
URI Supported Content Types Method /subscriptions/{stream}/{subscription_name} /subscriptions/{stream}/{subscription_name}?embed={embed} /subscriptions/{stream}/{subscription}/{count}?embed={embed}
application/vnd.eventstore.competingatom+xml application/vnd.eventstore.competingatom+json
GET
Query Parameters Parameter Description stream
The stream the persistent subscription is on. subscription_name
The name of the subscription group. count
How many events to return for the request. embed
None
, Content
, Rich
, Body
, PrettyBody
, TryHarder
Read Reading Streams for information on the different embed levels.
Response Acknowledgements Clients must acknowledge (or not acknowledge) messages in the competing consumer model. If the client fails to respond in the given timeout period, the message is retried. You should use the rel
links in the feed for acknowledgements not bookmark URIs as they are subject to change in future versions.
For example:
Ack multiple messages URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/ack?ids={messageids}
application/json
POST
Query Parameters Parameter Description stream
The stream the persistent subscription is on. subscription_name
The name of the subscription group. messageids
The ids of the messages that needs to be ACKed
Ack a single message URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/ack/{messageid}
application/json
POST
Query Parameters Parameter Description stream
The stream to the persistent subscription is on. subscription_name
The name of the subscription group. messageid
The id of the message that needs to be acked
Nack multiple messages URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/nack?ids={messageids}?action={action}
application/json
POST
Query Parameters Parameter Description stream
The stream to the persistent subscription is on. subscription_name
The name of the subscription group. action
Park : Don't retry the message, park it until a request is sent to reply the parked messagesRetry : Retry the messageSkip : Discard the messageStop : Stop the subscription messageid
The id of the message that needs to be acked
Nack a single message URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/nack/{messageid}?action={action}
application/json
POST
Replaying parked messages URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/replayParked
application/json
POST
URI Method /subscriptions
GET
Response Get subscriptions for a stream URI Supported Content Types Method /subscriptions/{stream}
application/json
GET
Response Getting a specific subscription URI Supported Content Types Method /subscriptions/{stream}/{subscription_name}/info
application/json
GET
Response Last Updated: 1/1/2021, 11:29:55 AM