Grails with DynamoDB

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails with DynamoDB

Brandon Wagner
I was wondering if anyone has had experience with using DynamoDB with Grails (2.4.3). I know there is a DynamoDB plugin but hasn't been updated in over two years. I was hoping to get some advise with integrating DynamoDB as the datastore for my application. Right now I'm using MongoDB, but I wanted to use DynamoDB for its ease of use and scale on the Amazon platform.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/421cbc09-2497-4089-9691-1048748a1f90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails with DynamoDB

Benoit HEDIARD
We are using DynamoDB in production with Grails and it's great!
Indeed, DynamoDB GORM Plugin is not maintained (and probably use a deprecated API).

So we are using the Mapper provided by the AWS Java SDK: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html
We create our 'domain' classes in Java with the corresponding mapper annotations.
Then we use a Grails service to wrap mapper calls with more "groovy" methods: createTable(), query(), get(), save(), increment(), etc.

If you are interested, I could add this service and some documentation to the AWS SDK Grails Plugin.
Let me know.

Le samedi 11 octobre 2014 04:31:26 UTC+2, Brandon Wagner a écrit :
I was wondering if anyone has had experience with using DynamoDB with Grails (2.4.3). I know there is a DynamoDB plugin but hasn't been updated in over two years. I was hoping to get some advise with integrating DynamoDB as the datastore for my application. Right now I'm using MongoDB, but I wanted to use DynamoDB for its ease of use and scale on the Amazon platform.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/58dfbb7e-84db-4e8a-97cd-453778e132e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails with DynamoDB

Brandon Wagner
That is interesting. However, I'm looking for a more flexible solution. I'd like to be able to use the GORM API and switch with little effort. We're a small startup and don't want to spend a lot of time rewriting code to try something out.

It looks like our best option (with keeping to GORM), is to stay with MongoDB and provision our own MongoDB servers on EC2 instances with a custom backup and scaling implementation.



On Saturday, October 11, 2014 3:45:56 AM UTC-4, Benoit Hediard wrote:
We are using DynamoDB in production with Grails and it's great!
Indeed, DynamoDB GORM Plugin is not maintained (and probably use a deprecated API).

So we are using the Mapper provided by the AWS Java SDK: <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html
We create our 'domain' classes in Java with the corresponding mapper annotations.
Then we use a Grails service to wrap mapper calls with more "groovy" methods: createTable(), query(), get(), save(), increment(), etc.

If you are interested, I could add this service and some documentation to the AWS SDK Grails Plugin.
Let me know.

Le samedi 11 octobre 2014 04:31:26 UTC+2, Brandon Wagner a écrit :
I was wondering if anyone has had experience with using DynamoDB with Grails (2.4.3). I know there is a DynamoDB plugin but hasn't been updated in over two years. I was hoping to get some advise with integrating DynamoDB as the datastore for my application. Right now I'm using MongoDB, but I wanted to use DynamoDB for its ease of use and scale on the Amazon platform.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/bdf2925f-61c5-414b-8e2f-7798f05f2930%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails with DynamoDB

Eric Wu
In reply to this post by Benoit HEDIARD
Hi Benoit

We are looking into Grails & DynamoDB as well. Can you please shed some light on the groovy mapper wrappers? 

Cheers
Eric

On Saturday, October 11, 2014 at 6:45:56 PM UTC+11, Benoit Hediard wrote:
We are using DynamoDB in production with Grails and it's great!
Indeed, DynamoDB GORM Plugin is not maintained (and probably use a deprecated API).

So we are using the Mapper provided by the AWS Java SDK: <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html
We create our 'domain' classes in Java with the corresponding mapper annotations.
Then we use a Grails service to wrap mapper calls with more "groovy" methods: createTable(), query(), get(), save(), increment(), etc.

If you are interested, I could add this service and some documentation to the AWS SDK Grails Plugin.
Let me know.

Le samedi 11 octobre 2014 04:31:26 UTC+2, Brandon Wagner a écrit :
I was wondering if anyone has had experience with using DynamoDB with Grails (2.4.3). I know there is a DynamoDB plugin but hasn't been updated in over two years. I was hoping to get some advise with integrating DynamoDB as the datastore for my application. Right now I'm using MongoDB, but I wanted to use DynamoDB for its ease of use and scale on the Amazon platform.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/f8430f16-d30e-4107-a02e-8a77ebc3440c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails with DynamoDB

Benoit HEDIARD
Hi Eric,

Here is our DynamoDBService abstract class:

How to use it:
1. create your Java-based domain class with DynamoDB java mapper (see SampleUser.java https://gist.github.com/benorama/b8ebe911da703b6ba96d#file-sampleuser-java)
2. create a Grails service that extends DynamoDBService and initialize it with your Java-based class (see SampleUserDBService.groovy https://gist.github.com/benorama/b8ebe911da703b6ba96d#file-sampleuserdbservice-groovy)

You can then use this service to interact with DynamoDB.
Example:
// Get user
SampleUser user = sampleUserDBService.get(1, 1) as SampleUser
if (!user) {
    user = new SampleUser(
             hashKey: 1,
             rangeKey: 1,
             name: 'foo'
    )
}

// Save user
sampleUserDBService.save(user)

// Update user name
sampleUserDBService.updateItemAttribute(1, 1, 'name', 'bar')

// List users by hash key
sampleUserDBService.query(1)

// Delete user
sampleUserDBService.delete(user) // or sampleUserDBService.delete(1, 1)

Let me know how it goes!

Benoit

Le 3 févr. 2015 à 04:26, Eric Wu <[hidden email]> a écrit :

Hi Benoit

We are looking into Grails & DynamoDB as well. Can you please shed some light on the groovy mapper wrappers? 

Cheers
Eric

On Saturday, October 11, 2014 at 6:45:56 PM UTC+11, Benoit Hediard wrote:
We are using DynamoDB in production with Grails and it's great!
Indeed, DynamoDB GORM Plugin is not maintained (and probably use a deprecated API).

So we are using the Mapper provided by the AWS Java SDK: <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdocs.aws.amazon.com%2Famazondynamodb%2Flatest%2Fdeveloperguide%2FJavaSDKHighLevel.html\46sa\75D\46sntz\0751\46usg\75AFQjCNHG_W5HEBog_oM5Jwbe55vN31Q9cw';return true;" class="">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html
We create our 'domain' classes in Java with the corresponding mapper annotations.
Then we use a Grails service to wrap mapper calls with more "groovy" methods: createTable(), query(), get(), save(), increment(), etc.

If you are interested, I could add this service and some documentation to the AWS SDK Grails Plugin.
Let me know.

Le samedi 11 octobre 2014 04:31:26 UTC+2, Brandon Wagner a écrit :
I was wondering if anyone has had experience with using DynamoDB with Grails (2.4.3). I know there is a DynamoDB plugin but hasn't been updated in over two years. I was hoping to get some advise with integrating DynamoDB as the datastore for my application. Right now I'm using MongoDB, but I wanted to use DynamoDB for its ease of use and scale on the Amazon platform.

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/0REDOVI5Jg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/f8430f16-d30e-4107-a02e-8a77ebc3440c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/BFF6E858-CAF8-4D66-A679-F84903A1C200%40benorama.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Grails with DynamoDB

danstadler
Hi Benoit:

Today I ran across the AWS SDK plugins you've provided, and specifically have been trying to get the DynamoDB plugin to work, but having quite a few problems getting it set up.
https://github.com/agorapulse/grails-aws-sdk/tree/master/grails-aws-sdk-dynamodb

Here are the specs:

grails -v
| Grails Version: 3.3.2
| Groovy Version: 2.4.13
| JVM Version: 1.8.0_25

I have altered build.gradle with the following 2 lines:
in repositories:   maven { url 'http://dl.bintray.com/agorapulse/libs' }
in dependencies:  compile 'org.grails.plugins:aws-sdk-dynamodb:2.1.5'

I am able to compile up to this step:
https://github.com/agorapulse/grails-aws-sdk/tree/master/grails-aws-sdk-dynamodb#data-modeling

However when I try the service definition step:
https://github.com/agorapulse/grails-aws-sdk/tree/master/grails-aws-sdk-dynamodb#service-definition

I am getting this:

/Users/dstadler/Documents/code/boxfuse/getstarted-grails/grails-app/services/getstarted/grails/FooItemDBService.groovy: 4: unable to resolve class grails.plugins.awssdk.dynamodb.AbstractDBService
 @ line 4, column 1.
   import grails.plugins.awssdk.dynamodb.AbstractDBService
   ^

This is failing when I try to compile from the grails command line, and as a side note I have not been able to successfully get dependencies working with Intellij either.

Any assistance appreciated: I would really like to try converting a Grails3 app to run using all of the AWS services that your plugin supports.

- dan

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/189b3f1f-8d14-4829-8d4a-6abd45bc8d3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.