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

Subscriptions with SQS protocol don't work in accordance with AWS API spec. #23

Open
mvmn opened this issue Mar 20, 2017 · 11 comments
Open

Comments

@mvmn
Copy link

mvmn commented Mar 20, 2017

When making subscription from SNS to SQS (protocol='sqs', endpoint=queue ARN), the error occurs:

ERROR a.c.i.Registry$RegistryLogStrategy - Actor[akka://sns/user/$a#1061847866] failed to activate
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: arn://aws:sqs:elasticmq:000000000000:testqueue due to: No component found with scheme: arn
	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:594) ~[sns-0.1.3.jar:0.1.3]
	at akka.camel.internal.ProducerRegistrar$$anonfun$receive$3.applyOrElse(CamelSupervisor.scala:164) ~[sns-0.1.3.jar:0.1.3]
...

Also it's not clear how one can set SQS endpoint URL - e.g. to localhost when using elasticMQ.

Can you elaborate on elasticMQ integration?

@s12v
Copy link
Owner

s12v commented Mar 20, 2017

@s12v s12v added the question label Mar 20, 2017
@mvmn
Copy link
Author

mvmn commented Mar 20, 2017

Thanks.

You seem to be using a URL as endpoint though, but, according to AWS documentation, for protocol "sqs" the endpoint should be queue ARN, not a URL.

See here:
For the sqs protocol, the endpoint is the ARN of an Amazon SQS queue

@s12v
Copy link
Owner

s12v commented Mar 20, 2017

@mvmn, yes, I can't use ARN, because it's not a real SNS/SQS... format should match http://camel.apache.org/aws-sqs.html

@mvmn
Copy link
Author

mvmn commented Mar 20, 2017

Well, if you'd have a URL to elasticMQ configured, all you'd need is queue name I suppose.
And queue name can be taken from ARN - it's just a last part of ARN, all after last colon.

This is documented also:

Amazon Simple Queue Service (Amazon SQS)

Syntax:
arn:aws:sqs:region:account-id:queuename

@s12v
Copy link
Owner

s12v commented Mar 20, 2017

@mvmn, but I don't have elasticMQ URL anywhere, except the endpoint string
Let's say, I give it ARN - how would it figure out it's localhost?

@mvmn
Copy link
Author

mvmn commented Mar 20, 2017

I mean you could have a configuration property (or, say, a command-line argument) for your app that would contain SQS URL (+possibly also accessKey+secretKey), and then use that to convert ARN into aws-sqs://<queue-name>?amazonSQSEndpoint=http://<SQS host:port>&accessKey=<Access key>&secretKey=<Secret key>.

Then one could run elasticMQ on known host:port (say, localhost:9324 - which is the default for elasticMQ), and use your app with it using proper AWS SDK calls.

@mvmn mvmn changed the title Subscriptions with SQS protocol don't work Subscriptions with SQS protocol don't work according to AWS API spec. Mar 20, 2017
@mvmn mvmn changed the title Subscriptions with SQS protocol don't work according to AWS API spec. Subscriptions with SQS protocol don't work in accordance with AWS API spec. Mar 20, 2017
@s12v
Copy link
Owner

s12v commented Mar 20, 2017

@mvmn, could you please provide a complete use-case for this? How do you use this and where is SQS ARN coming from?

@mvmn
Copy link
Author

mvmn commented Mar 20, 2017

SQS ARN is coming from ElasticMQ.

I'm running ElasticMQ and your SNS emulator on my local dev machine, where I develop an app that uses SNS and SQS. Since I don't want to use the real thing during development, I try to replace it with emulators (again, ElasticMQ for SQS, and your emulator for SNS).

The app I'm developing creates SQS queue in ElasticMQ (using Amazon Java SDK), then topic in SNS emulator, and then tries to create subscription in SNS emulator for that SQS queue - using valid Amazon API call (done via Java SDK), which requires me to submit topic ARN, protocol, and endpoint parameters.

According to API description, for SQS protocol the endpoint parameter must be queue ARN (see aforementioned quotes from Amazon documentation).

But you seem to expect a URL that's not even valid in SQS, but is some Camel-specific URL.

@s12v
Copy link
Owner

s12v commented Mar 20, 2017

@mvmn, ok, makes sense. I'll try to do it when I have some time. Or maybe you are interested in submitting a PR? That would be awesome.

@s12v s12v added enhancement and removed question labels Mar 20, 2017
@mvmn
Copy link
Author

mvmn commented Mar 20, 2017

Unfortunately, I'm only good with Java, but never did any Scala.
But I'll try things out and if I'll manage to cope with Scala - will do a pull request.

And thank you for your time and effort developing this thing.

@hzshlomi
Copy link

FYI - I gave it a shot here:
#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants