Eduardo De Almeida Almuiña created CAMEL-12820:
--------------------------------------------------

             Summary: SQS: Malformed queue URL due to bad region parsing
                 Key: CAMEL-12820
                 URL: https://issues.apache.org/jira/browse/CAMEL-12820
             Project: Camel
          Issue Type: Bug
          Components: camel-aws
    Affects Versions: 2.22.1
         Environment: AWS, Centos 7, Java 8, Spring boot 2
            Reporter: Eduardo De Almeida Almuiña


h3. Diagnosis
When configuring the component with a queue ARN, for example:

{{aws-sqs://arn:aws:sqs:eu-west-1:account-number:queue-name}}

The region is being parsed as {{EU_WEST_1}}. See 
[https://github.com/apache/camel/blob/master/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsComponent.java#L64]

The region is then used in the construction of the queue URL in 
https://github.com/apache/camel/blob/master/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java#L132

This creates a URL pointing to the wrong host: 
{{https://sqs.EU_WEST_1.amazonaws.com/account-number/queue-name}}

Subsequents polls of the sqs component failed due to to this host not being 
recognised:

{code}java.net.UnknownHostException: sqs.EU_WEST_1.amazonaws.com{code}

h3. Proposed solution
Invoke the {{getName}} method instead of {{toString}} the 
https://github.com/apache/camel/blob/master/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsComponent.java#L64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to