-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support cross-region SNS topic subscription #71
base: master
Are you sure you want to change the base?
Support cross-region SNS topic subscription #71
Conversation
9d90b0e
to
d87ddde
Compare
Please let me know if you think I should take another option (or this request is not acceptable in the first place 😂 ). |
cc @cookpad/dev-infra |
@@ -44,6 +46,12 @@ def destroy | |||
private | |||
|
|||
def fetch_sns_topic_arns | |||
Barbeque::SNSSubscriptionService.sns_client.list_topics.topics.map(&:topic_arn) | |||
if Barbeque.config.sns_regions.empty? | |||
Aws::SNS::Client.new.list_topics.topics.map(&:topic_arn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aws::SNS::Clinet should be memoized because Aws::SNS::Client.new retrieves credentials each time when ECS task role or EC2 instance profile is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
06d3a6c ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2a14998 (revised commit comment 💦 )
@@ -7,5 +7,9 @@ class SNSSubscription < ApplicationRecord | |||
validates :topic_arn, | |||
uniqueness: { scope: :job_queue, message: 'should be set with only one queue' }, | |||
presence: true | |||
|
|||
def region | |||
/\Aarn:aws:sns:([a-z0-9-]+):/.match(topic_arn)[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) /\Aarn:aws:sns:([a-z0-9-]+):/.slice(topic_arn, 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0a81ea7 ✨
06d3a6c
to
2a14998
Compare
FYI conflicted ;) |
2a14998
to
f581ea6
Compare
Thanks, rebased ✨ |
I would like to support subscribing a topic in a different region from the SQS queue.
I came up with a few options:
This is an implementation of the third option, which involves no change in UI.