camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbogdanoff <ron.bogdan...@gmail.com>
Subject aws-sqs returns exception 'The request must contain the parameter Attribute.Name'
Date Wed, 21 Nov 2012 00:14:07 GMT
Hi, 

Am trying to use camel aws-sqs endpoint to send a message.  I can do this no
problem with Java AWS API directly, but with camel I am having trouble. 
Here is my code...

package com.equilar.camelexamples;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.sqs.AmazonSQSClient;


public class SQS {

	
	 public void  exec(String command) {
		 try {
	        // create CamelContext
			SimpleRegistry registry = new SimpleRegistry();
			AWSCredentials awsCredentials = new BasicAWSCredentials("mykey",
"mysecretkey");
	        ClientConfiguration clientConfiguration = new
ClientConfiguration();
	        AmazonSQSClient client = new AmazonSQSClient(awsCredentials,
clientConfiguration);
	        registry.put("amazonSQSClient" , client);
	        CamelContext context = new DefaultCamelContext(registry);

	        // add our route to the CamelContext
	        context.addRoutes(new RouteBuilder() {
	        	public void configure() {
	        		    from("file:/tmp/mydir?fileName=myfile.txt")
	        			.to("aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient");
	        	}
	        });

	        
	        context.start();

	        context.stop();
		 } catch ( Exception e ) {
			 throw new RuntimeException(e);
		 }

	 }

}

I get this exception...

java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at: >>>
To[aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient] <<< in route:
Route[[From[file:/tmp/mydir?fileName=myfile.txt]] -> [To[aws... because of
Failed to resolve endpoint:
aws-sqs://MyQueue?amazonSQSClient=%23amazonSQSClient due to: The request
must contain the parameter Attribute.Name.
	at com.equilar.camelexamples.SQS.exec(SQS.java:58)
	at com.equilar.camelexamples.SQSTest.test2(SQSTest.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> To[aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient]
<<< in route: Route[[From[file:/tmp/mydir?fileName=myfile.txt]] ->
[To[aws... because of Failed to resolve endpoint:
aws-sqs://MyQueue?amazonSQSClient=%23amazonSQSClient due to: The request
must contain the parameter Attribute.Name.
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:873)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)
	at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)
	at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1575)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412)
	at com.equilar.camelexamples.SQS.exec(SQS.java:54)
	... 24 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: aws-sqs://MyQueue?amazonSQSClient=%23amazonSQSClient due
to: The request must contain the parameter Attribute.Name.
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:479)
	at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
	at
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:186)
	at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
	at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
	at
org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:61)
	at
org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:55)
	at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:441)
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:870)
	... 32 more
Caused by: Status Code: 400, AWS Service: AmazonSQS, AWS Request ID:
cd5d1220-0524-5cf8-aed7-5b061e896d5c, AWS Error Code: MissingParameter, AWS
Error Message: The request must contain the parameter Attribute.Name.
	at
com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:556)
	at
com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:289)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:170)
	at
com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:812)
	at
com.amazonaws.services.sqs.AmazonSQSClient.setQueueAttributes(AmazonSQSClient.java:246)
	at
org.apache.camel.component.aws.sqs.SqsEndpoint.updateQueueAttributes(SqsEndpoint.java:139)
	at
org.apache.camel.component.aws.sqs.SqsEndpoint.doStart(SqsEndpoint.java:93)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
	at
org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1763)
	at
org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:931)
	at
org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:892)
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:475)
	... 41 more

What could be the problem?

Regards
Ron Bogdanoff



--
View this message in context: http://camel.465427.n5.nabble.com/aws-sqs-returns-exception-The-request-must-contain-the-parameter-Attribute-Name-tp5723036.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message