You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Maksym Shalak (JIRA)" <ji...@apache.org> on 2018/11/14 13:56:00 UTC
[jira] [Created] (CAMEL-12934) Camel SQS regression
Maksym Shalak created CAMEL-12934:
-------------------------------------
Summary: Camel SQS regression
Key: CAMEL-12934
URL: https://issues.apache.org/jira/browse/CAMEL-12934
Project: Camel
Issue Type: Bug
Components: camel-aws
Affects Versions: 2.22.1
Reporter: Maksym Shalak
After upgrade from Camel 2.14 to 2.22.1, I have noticed we completely removed support of amazonSQSEndpoint parameter from SqsConfiguration and related classes: [https://github.com/apache/camel/commit/adfdda36cd6d4736ee292f13514badd58b2dbe5b#diff-10c0ab07ac9c261a8e9a5c1ce1dd8f4c] .
As a side affect, all previous code where we create SQS endpoint from URL (through DefaultCamelContext.getEndpoint(String uri)) and still pass URL parameter amazonSQSEndpoint started to fail with validation Exception:
{code:java}
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: aws-sqs://SQSTarget?accessKey=...&amazonSQSEndpoint=https%3A%2F%2Fsqs.us-west-2.amazonaws.com&secretKey=... due to: Failed to resolve endpoint: aws-sqs://SQSTarget?accessKey=...&amazonSQSEndpoint=https%3A%2F%2Fsqs.us-west-2.amazonaws.com&secretKey=... due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{amazonSQSEndpoint=https://sqs.us-west-2.amazonaws.com}]
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:758)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:221)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:122)
at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62)
at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56)
at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:562)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:523)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:239)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1343)
... 34 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: aws-sqs://SQSTarget?accessKey=...&amazonSQSEndpoint=https%3A%2F%2Fsqs.us-west-2.amazonaws.com&secretKey=... due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{amazonSQSEndpoint=https://sqs.us-west-2.amazonaws.com}]
at org.apache.camel.impl.DefaultComponent.validateParameters(DefaultComponent.java:215)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:139)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:711)
... 44 more{code}
It happens because deeper we use IntrospectionSupport to go through SqsConfiguration class setters via reflection to set all SQS parameters. And since setter for amazonSQSEndpoint was removed, we leave this parameter unparsed, and later we treat all unparsed parameters as invalid in DefaultComponent.validateParameters.
Was this behavior intentional? AWS library, which is used underneath, still supports this parameter, it just allows only either region or amazonSQSEndpoint, and amazonSQSEndpoint has priority. From com.amazonaws.client.builder.AwsClientBuilder:
{code:java}
private void setRegion(AmazonWebServiceClient client) {
if (region != null && endpointConfiguration != null) {
throw new IllegalStateException("Only one of Region or EndpointConfiguration may be set.");
}
if (endpointConfiguration != null) {
client.setEndpoint(endpointConfiguration.getServiceEndpoint());
client.setSignerRegionOverride(endpointConfiguration.getSigningRegion());
} else if (region != null) {
client.setRegion(region);
} else {
final String region = determineRegionFromRegionProvider();
if (region != null) {
client.setRegion(RegionUtils.getRegion(region));
} else {
throw new SdkClientException(
"Unable to find a region via the region provider chain. " +
"Must provide an explicit region in the builder or setup environment to supply a region.");
}
}
}{code}
My suggestion:
# Return back amazonSQSEndpoint parameter so older code does not fail.
# If amazonSQSEndpoint removal was made because of AWS limitations, and both parameters are present, we may just use amazonSQSEndpoint and ignore region, as AWS does.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)