Easier to use Java Client

Rexxe rexxe98 at gmail.com
Tue Mar 29 03:32:37 EDT 2011

Yes, Jackson is being used to do the marshalling if it's a bean, but I am
using Spring's RestTemplate, which decides whether to use Jackson or some
other basic marshalling (e.g. byte[] or String, etc.).  This allows me to
deal with responses that come back from Riak that are not in JSON (e.g.

It looks like you haven't gotten very far yet, which is good and bad I guess
:-).  You are definitely taking a different approach than me.  I pretty much
used the Spring templates (e.g. JDBCTemplate, HibernateTemplate, etc.) as my
guides since I found them incredibly useful and time-saving.  Take a look at
my tests, the one for the RiakRestClient is pretty complete, and you can see
how to use the client API.  The template API is just another abstraction on
top of the client for common operations so that the developer doesn't have
to deal with more low level objects.  The template API is not totally done
as I want to add a couple more common ops that people might need (e.g.
count), but everything should work in it.

Thanks for checking it out!  Please share any thoughts you might have on the

On Tue, Mar 29, 2011 at 12:15 AM, Russell Brown <russell.brown at me.com>wrote:

> On 29 Mar 2011, at 06:28, Rexxe wrote:
> Hello,
> I am new to Riak and the mailing list.  I started to use Riak using the
> spring-data project but found that their API was lacking and had serious
> issues with strict typing.  It turns out that the Java API they've built is
> pretty much being built just so it works in Grails/Groovy.  So, I started to
> look at the Riak Java API.  I found it to be a bit complicated and I didn't
> like how it still forced the user to know about a lot of specifics of Riak,
> especially query params and other properties, and didn't provide a layer of
> abstraction on top of the actual client (so I could say go switch between
> the REST and PBC client).
> Here here. I'm working on that, too. There is a draft of the API here
> https://github.com/russelldb/riak-java-client-api/tree/fluent
> So, I decided to write my own client and semi-ORM layer.   I am still
> working on some of the details, I need to write more tests, and I need to
> document it, but the bulk of the code is done. I have only implemented the
> REST client so far, but I plan on implementing PB in the future.
> You can check it out here: https://github.com/aberman/spring-riak
> It's pretty easy to use:
> If you want the client, you would do:  RiakManager mgr = new
> RiakRestClient(...);
> The ORM layer (still working a bit on this): RiakTemplate template = new
> RiakTemplate(new RiakRestClient(...));
> What are you using to marshall to java objects? Jackson?
> The APIs to look at are RiakManager and RiakTemplate and you should see
> some familiar methods with more typed signatures to help out the average
> user.
> Let me know your thoughts, if any, and if there is any interest in me
> donating this to the Riak project.
> I've only had a brief look but I like it very much, thanks for making it
> and sharing it.  We seem to have covered a lot of the same ground but it is
> great to have a diverse range of clients for different use cases. I'll pull
> the repo and have a more detailed look, I'm hoping you may have solved some
> of the problems I'm looking at already ;)
> Andrew
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110329/dec229dc/attachment.html>

More information about the riak-users mailing list