-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
request: allow queues in shoryuken.yml to be provided as ARN values #602
Comments
Hi @nippysaurus Shoryuken can work with queue name or URL. You can get You could also output then. new cdk.CfnOutput(this, "QUEUE_URL", { value: queue.queueURL });
new cdk.CfnOutput(this, "QUEUE_NAME", { value: queue.queueName }); The AWS SDK Ruby expects There are also some alternatives, for example, converting from ARN to URL or Name in your I don't recall previous requests for that, but I'm open to pull requests if the logic makes sense in case you are interested in submitting one. |
Yeah it's easy to do the mapping, but with the URL and ARN being so easily translated it would be nice to be able to supply either and have Shoryuken figure out what it is. I took your advice and did the mapping in the config. # config/initializers/shoryuken.rb
def SqsArnToUrl(arn_str)
return unless arn_str
arn = Aws::ARNParser.parse(arn_str)
raise "please pass an shoryuken queue ARN with region, account_id, and resource values (#{arn_str})" if [
arn.region,
arn.account_id,
arn.resource
].any? { |value| value == "" || value == nil }
`https://sqs.#{arn.region}.amazonaws.com/#{arn.account_id}/#{arn.resource}`
end It would be great if this was in the Shoryuken framework though. |
@nippysaurus yay I'm happy it worked! The code makes sense to me. Would you like to submit a PR?
|
Minor code tweak: def queue_url_from_arn(arn_str)
arn = Aws::ARNParser.parse(arn_str)
required = [arn.region, arn.account_id, arn.resource]
raise "please pass an shoryuken queue ARN with region, account_id, and resource values (#{arn_str})" if required.any?(&:empty?)
"https://sqs.#{arn.region}.amazonaws.com/#{arn.account_id}/#{arn.resource}"
rescue Aws::Errors::InvalidARNError
raise "Invalid ARN: #{arn_str}"
end |
Thanks @phstc :) I'll try and put in some effort to get an MR up this week. |
Added to 5.0.5 |
I'm writing a CDK template for deploying an application with a lot of Shoryuken queues. Everything in AWS is using the ARN, but Shoryuken only works with URL and not ARN. These values are easy translated from one format to the other, but with so many queues it would still be a lot of mapping values in my code to do the translation. It would be super convenient if Shoryuken would do this for me.
Here you can see how the AWS CDK template does the mapping
The text was updated successfully, but these errors were encountered: