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-59] Adding the possibility of pass a custom prefix for Google PubSub #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KristianLentinoCT
Copy link

Like requested on this issue I'm here to propose a way to let the user customize the prefix for Google PubSub subscriptions, while keeping the default value as it is inside the companion object of the new PubSubConfig case class.
Let me know your thoughts!

@KristianLentinoCT KristianLentinoCT self-assigned this Oct 21, 2024
Copy link
Member

@AL333Z AL333Z left a comment

Choose a reason for hiding this comment

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

Thanks @KristianLentinoCT for picking this up.

I left two minor comments, you will also need to fix the pipeline due to mima exceptions (the plugin if too strict, we know...).
The error messages will guide you on how to fix that, just reach out if you need help.

@@ -72,7 +73,7 @@ private class PubSubAdministration[F[_]](
Subscription
.newBuilder()
.setTopic(topicName.toString())
.setName(SubscriptionName.of(project, s"fs2-queue-$name").toString())
.setName(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name").toString())
Copy link
Member

@AL333Z AL333Z Oct 22, 2024

Choose a reason for hiding this comment

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

Minor: should we omit the -, so that one can also omit the prefix and only go with the name?

Suggested change
.setName(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name").toString())
.setName(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name").toString())

Choose a reason for hiding this comment

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

I don't like that if I want to add a - in the name I should set the subscriptionNamePrefix to something like prefx-. Maybe we can be smarter and trying another approach? WDYT? Maybe we can let the PubSubConfig be an Option so that we can use only the name when the config provided is None ?

case class PubSubConfig(subscriptionNamePrefix: String)

object PubSubConfig {
val default: PubSubConfig = PubSubConfig("fs2-queue")
Copy link
Member

@AL333Z AL333Z Oct 22, 2024

Choose a reason for hiding this comment

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

Shall we just provide an empty string as a default?
I'm not sure what was the reasoning behind this choice, are there any implications on leaving this empty? @satabin maybe knows more.

Suggested change
val default: PubSubConfig = PubSubConfig("fs2-queue")
val default: PubSubConfig = PubSubConfig("")

Choose a reason for hiding this comment

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

TBH as an end user I would still prefer to have some kind of prefix instead of not having one, but I'm happy to discuss the best option with you and @satabin

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.

3 participants