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

Use rele without creating a subscription #224

Open
alysivji opened this issue Jul 4, 2022 · 4 comments
Open

Use rele without creating a subscription #224

alysivji opened this issue Jul 4, 2022 · 4 comments

Comments

@alysivji
Copy link

alysivji commented Jul 4, 2022

Looking through the documentation and the code, this library creates a new subscription on the PubSub topic specified in the sub decorator.

I'm looking to separate code that creates infrastructure from code that processes subscriber messages. Ideally, my subscribers would be created in Terraform along with the retry / dead letter topic config for each subscriber. I'm also hesitant to provide my subscribers with additional permissions beyond reading and acknowledging messages for a given set of subscriptions

Is it possible to use rele without creating a subscription? If not, is this a feature you would accept a PR for?

@alysivji alysivji changed the title Use library without creating a subscription Use rele without creating a subscription Jul 4, 2022
@andrewgy8
Copy link
Contributor

In theory this should work without issue according to this https://github.com/mercadona/rele/blob/master/rele/client.py#L62

Have you tried it already?

@andrewgy8
Copy link
Contributor

andrewgy8 commented Jul 5, 2022

Ah right, having thought about this for aa few minutes, this makes perfect sense.

The reason we create a subscription is due to when the worker spin ups the first time and the subscription is not there, we create one.

On any subsequent start of the worker, the subscription registered in GCP will be there. Meaning that we dont create a subscription hence the suppression linked above.

So to further answer your question, you creating a subscription with Terraform should be no issue. Just make sure your subscription/topic names match up and you should be good.

@alysivji
Copy link
Author

alysivji commented Jul 6, 2022

Thanks for the prompt reply! I'm going to be working on this next sprint and will check back in once I try out your suggestion

@andrewgy8
Copy link
Contributor

@daniel-ruiz this issue can be closed 😉

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

No branches or pull requests

2 participants