Hi, I just found something interesting, you add the tableName into the PutReqeuest, but you don’t specify tableName on the url.
-- 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 3:34:20 PM, cdfleischmann (cdfleischm...@gmail.com) wrote: > Hi...So the solution I created (which seems to work), is as > follows:Imports:/*import > com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider;import > com.amazonaws.regions.Region;import com.amazonaws.regions.Regions;import > com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;import > com.amazonaws.services.dynamodbv2.model.AttributeValue;import > com.amazonaws.services.dynamodbv2.model.PutItemRequest;import > com.amazonaws.services.dynamodbv2.model.PutItemResult;*/I used a mapping > function for the attributes I want to add to DynamoDB like so;/*private > static Map newSourceItem(Item sourceItem) { > Map item = new HashMap(); > item.put("xxx", new AttributeValue(sourceItem.getXXX())); > item.put("yyy", new AttributeValue(sourceItem.getYYY())); > item.put("zzz", new > AttributeValue().withN(String.valueOf(sourceItem.getZZZ()))); > item.put("id", new > AttributeValue().withN(String.valueOf(sourceItem.getId()))); > return item; }*/In my case, the id is the hash number I used. I did not > add a Hash Range.Now the code to initialise the dbClient follows:/*/* * This > credentials provider implementation loads your AWS credentials * from a > properties file at the root of your classpath. */ dynamoDB = new > AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider()); > Region apSouthEast2 = Region.getRegion(Regions.AP_SOUTHEAST_2); > dynamoDB.setRegion(apSouthEast2);*/And lastly the Put method to add it to > DynamoDB:/*PutItemRequest putItemRequest = new PutItemRequest(tableName, > attributeMap); PutItemResult putItemResult = > dynamoDB.putItem(putItemRequest); System.out.println("Result: " + > putItemResult);*/Whereas my last Camel attempt was as follows:/*/** * Send > the array map to the DynamoDB routes. * * @param route The route to send > it to. * @param exchange The MSG Exchange. * @param attributeMap The > Attribute Map to send off to DyanamoDB. */ private void sendMessage(String > route, Exchange exchange, final Map attributeMap) > { System.out.println("Add item to DynamoDB"); 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); } > }); }*/with the "route" string > being:/*sendMessage("aws-ddb://SourceItems?amazonDDBClient=#ddbClient&amazonDdbEndpoint=ap-southeast-2" > > + "&writeCapacity=10&readCapacity=10", newSourceItem(sourceItem));*/I am no > Camel expert, but it seems the exchange.getIn().setHeader(...) isn't working > as planned? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/AWS-CAMEL-DynamoDB-Please-Help-tp5748581p5748605.html > > Sent from the Camel - Users mailing list archive at Nabble.com.