Subscriptions in Pulsar
Subscriptions in Pulsar describe which consumers are consuming data from a topic and how they want to consume that data.
Subscriptions are managed in the broker as a collection of metadata about a topic and its subscribed consumers. This metadata includes:
Topic name - which topic the consumer wants data from
Subscription name - a string representing a qualified name for the subscription
Subscription type - which type of subscription is being used
Subscription cursor - a representation of the consumer’s current place in the subscribed topic log
For example, the Pulsar consumer below has a shared subscription starting at the earliest cursor position in
pulsarConsumer = pulsarClient.newConsumer(Schema.BYTES) .topic("my-topic") .subscriptionName("my-subscription") .subscriptionType(SubscriptionType.Shared) .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) .subscribe();
Read on to use Pulsar’s four types of subscriptions to manage your topic consumption.
Follow our simple guide to get started with Astra now.
For using Kafka with Astra Streaming, see Starlight for Kafka.