Call auto-subscription to topics for subscribers that implement it#25
Merged
paradigm314 merged 7 commits intolifechurch:masterfrom Jun 16, 2020
Merged
Conversation
Contributor
Author
|
I'll need to add a couple tests for this change, and add the documentation to use this. |
Contributor
Author
|
OH! I see the documentation is actually on a Github Wiki... I'll post an example of how to implement an |
Contributor
Author
|
This is a simple example of how to implement the "Auto-subscribe" method. Of course, you might implement a more complex logic if you need it: class MyAutoSubscriber
include Subserver::Subscriber
subserver_options queue: 'default'
def self.auto_subscribe
client = Subserver::Pubsub.client
client.topic('my-topic-name').tap do |topic|
topic.subscription('my-topic-subscription-name') ||
topic.subscribe('my-topic-subscription-name')
end
end |
Contributor
Author
|
@WintheDay Please take a look at this :) |
paradigm314
approved these changes
Jun 16, 2020
Contributor
|
@vovimayhem Sorry it took a while to look at this. It looks great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Implements the plumbing that would enable subscribers to automatically create a subscription to a topic, if the Subscriber class implements how to do it.
This feature would be required for #17