camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdfleischmann <cdfleischm...@gmail.com>
Subject AWS + CAMEL + DynamoDB - Please Help
Date Tue, 11 Mar 2014 00:36:23 GMT
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<String, 
			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<KeySchemaElement> tableKeySchema = new
ArrayList<KeySchemaElement>();
        		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