Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue 468] Add Support for NonDurable subscriptions #992

Merged
merged 7 commits into from
Jun 15, 2023

Conversation

dinghram
Copy link
Contributor

@dinghram dinghram commented Mar 17, 2023

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

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • *Added test to ensure non-durable subscription is removed when last consumer is removed.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: yes (added SubscriptionMode option to ConsumerOptions struct )
  • The schema: don't know
  • The default values of configurations: no
  • The wire protocol: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? GoDocs
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@dinghram dinghram marked this pull request as ready for review May 23, 2023 21:09
@BewareMyPower BewareMyPower added this to the v0.11.0 milestone Jun 12, 2023
Copy link
Member

@shibd shibd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@BewareMyPower BewareMyPower merged commit 5a1824b into apache:master Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for NonDurable subscriptions
3 participants