Message Retention
Before we start our first producer and consumer, it’s important to mention the following default Pulsar message retention.
By default, messages not within a backlog may get deleted. This could be messages on topics that have no subscriptions, or messages that were in a subscription but have been acknowledged. This is important to mention because you may be creating a new topic, publishing messages to it, and then observe that the first few messages aren’t showing up in your consumer. That’s because no subscription existed at the time the messages were produced. You can prevent this from happening by starting up your consumer before your producer in order to create a subscription.
Note that once you consume the message in all subscriptions on a topic (it’s no longer in any subscription backlog), the message is eligible for deletion. We will not be discussing message retention policies in this course. More information can be found here.
