Introducing Subscriptions
Before we test our sample code from the StreamNative UI, let’s introduce subscriptions. Subscriptions allow consumers to sign up for messages on a topic. The subscription type defines how those messages will be distributed to consumers. Each subscription can have multiple consumers (we will demonstrate this next for each subscription type!) and each topic can have multiple independent subscriptions. The four subscriptions types are:
- Exclusive: Only a single consumer can attach to the subscription.
- Failover: When using single partitioned topic, multiple consumer instances can connect to the topic but only one will receive messages. We will revisit this subscription type after we increase the number of partitions.
- Shared: Multiple consumers can connect to the same subscription.
- Key_Shared: Multiple consumers can connect to the same subscription, but messages with the same key will always be sent to the same consumer.

Using our sample code from the StreamNative UI, let’s test out each of these subscription types. As we test each subscription, we will also discuss any ordering guarantees.
