[Issue 468] Add Support for NonDurable subscriptions #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #468
Motivation
This change allows the Go Pulsar Client to create consumers with non-durable subscriptions. We use Pulsar in an enterprise level application that processes large amounts of data throughput. We are adding a component that creates a consumer on that throughput, and it is very important that the throughput is not affected by this component. If the component creates a durable subscription, then goes down for whatever reason, the backlog caused by a durable subscription could bring our enterprise application down. Allowing a consumer to be non-durable alleviates this problem.
It has been suggested that we could use a Pulsar Reader instead of a Consumer, but then we cannot easily spread the load of messages across multiple pods, as each pod would not know which messages the other pod had processed. It has also been suggested that we could use "aggressive subscription/topic removal policies" to achieve this, but our enterprise level application has the policies already defined and changing them could have other, unintended side-effects.
This change brings a feature to the Go Pulsar Client which is already supported by the Java client.
Modifications
This change exposes the SubscriptionMode outside the pulsar package, and adds SubscriptionMode as an option in ConsumerOptions. The default remains "Durable".
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
Documentation