camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: AWS + CAMEL + DynamoDB - Please Help
Date Tue, 11 Mar 2014 03:28:23 GMT
No, you cannot add the the keySchema into the uri. Current camel-aws-ddb just takes the KeySchema
from the message header.

I just checked the code of PutItemCommand, it put any KeySchema into request item. The interesting
part is aws SDK has a dynamodbv2 package. It looks like AWS has the plan to move to new dynamo
db API. I’m not sure if it relates to your issue.

Please let us know if you found out the old dynamodb API is retired.


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 11, 2014 at 8:36:51 AM, cdfleischmann (cdfleischmann@gmail.com) wrote:
> Hello folks, I have tried to use the AWS Camel Component for DynamoDB as
> discussed here:http://camel.apache.org/aws-ddb.html... I am following the
> snippet of code in the MOCK Services testing area, as listed here:
> https://github.com/apache/camel/blob/master/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/DdbComponentIntegrationTest.java
 
>  
> I see in the example that you are meant to replace the Access Key and Secret
> Key, but otherwise the example should be ok??
>  
> However, I received the following error (and this was after I added the
> readCapacity and writeCapacity variables:
>  
> /*org.apache.camel.ResolveEndpointFailedException: Failed to resolve
> endpoint:
> aws-ddb://table?amazonDDBClient=%23ddbClient&amazonDdbEndpoint=ap-southeast-2&readCapacity=10&writeCapacity=10
 
> due to: Status Code: 400, AWS Service: AmazonDynamoDB, AWS Request ID:
> KHA79STK78SHC2BG2R8HLPF7RJVV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Code:
> ValidationException, AWS Error Message: 2 validation errors detected: Value
> null at 'keySchema.hashKeyElement.attributeName' failed to satisfy
> constraint: Member must not be null; Value null at
> 'keySchema.hashKeyElement.attributeType' failed to satisfy constraint:
> Member must not be null*/
>  
> How do you add the keySchema to the URI? I note that it needs to be of type
> KeySchema? I have tried the following:
>  
> //**
> * Send the array map to the DynamoDB routes.
> *
> * @param route The route to send it to.
> * @param exchange The MSG Exchange.
> * @param producer The Producer template to use.
> * @param attributeMap The Attribute Map to send off to DyanamoDB.
> */
> private void sendMessage(String route, Exchange exchange, final Map> AttributeValue>
attributeMap, final Integer id) {
> Exchange exchange2 = producer.send(route, new Processor() {
> public void process(Exchange exchange) throws Exception {
> exchange.getIn().setHeader(DdbConstants.OPERATION,
> DdbOperations.PutItem);
> exchange.getIn().setHeader(DdbConstants.RETURN_VALUES,
> "ALL_OLD");
> exchange.getIn().setHeader(DdbConstants.ITEM, attributeMap);
> exchange.getIn().setHeader(DdbConstants.KEY, id);
>  
> ArrayList tableKeySchema = new
> ArrayList();
> tableKeySchema.add(new
> KeySchemaElement().withAttributeName("id").withKeyType(KeyType.HASH));
>  
> exchange.getIn().setHeader(DdbConstants.KEY_SCHEMA,
> tableKeySchema.get(0).);
> }
> });
>  
> System.out.println("LIST: " +
> exchange2.getIn().getHeader(DdbConstants.ITEMS, List.class));
> }/
>  
> But it doesn't work... Any ideas or thoughts to progress?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/AWS-CAMEL-DynamoDB-Please-Help-tp5748581.html
 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Mime
View raw message