Using PBClusterConfig with RiakClient

Ahmed Bashir ahmed.m.bashir at gmail.com
Wed Apr 11 17:15:07 EDT 2012


It's not clear why the raw client API can't store() a RiakObject; it
looks like I need to implement IRiakObject myself

On Wed, Apr 11, 2012 at 1:39 PM, Russell Brown <russell.brown at me.com> wrote:
>
> On 11 Apr 2012, at 21:20, Ahmed Bashir wrote:
>
>> Thanks Russell!
>>
>> Any benefit to using IRiakClient vs RawClient other than what's
>> apparent in the API spec?
>>
>
> RawClient leaves you to deal with all the trade-offs that are consequences of using fault-tolerant, distributed databases like Riak, IRiakClient offers one set of possible well-behaved approaches.
>
> With RawClient, you need to retry a failure, IRiakClient has a default retrier and lets you provide a custom one of your own to handle faults. RawClient will give you an array of Riak Objects and a vector clock where IRiakClient makes it easy to convert the payload to a domain type to simplify sibling resolution. IRiakClient will always fetch before a store and will pass the vector clock for you.
>
> Which you chose depends on what code you want to write and the style you prefer to code in. IRiakClient is there to make it harder for people to shoot themselves in the foot and to incorporate some best practices for being a well behaved Riak client, RawClient is used by IRiakClient, and can certainly be used to build your own interactions with Riak.
>
> I hope that helps explain why there are there 2 layers that you can use, one building on the other.
>
> Please feel free to ask away if I can clear it up any more,
>
> Cheers
>
> Russell
>
>> On Wed, Apr 11, 2012 at 12:09 PM, Russell Brown <russell.brown at me.com> wrote:
>>> Hi Ahmed,
>>>
>>> On 11 Apr 2012, at 19:45, Ahmed Bashir wrote:
>>>
>>> Thanks for the link; this is precisely what led me to believe that
>>> PBClusterConfig only supports IRiakClient, so I thought I'd ask around
>>>
>>>
>>> PBClusterConfig is used to produce a RawClient. IRiakClient is just a
>>> wrapper around RawClient. The cluster client is a RawClient. RawClient is
>>> more like that legacy RiakClient/RiakObject classes you're using.
>>>
>>> See http://basho.github.com/riak-java-client/1.0.5/com/basho/riak/client/raw/pbc/PBRiakClientFactory.html for
>>> details.
>>>
>>> Cheers
>>>
>>> Russell
>>>
>>>
>>> ...
>>>
>>> Also, if we create a RiakClient with a single host (and others exist),
>>> is there any auto-dicovery that goes on to balance the requests across
>>> ll ring members, or will that one host process all the app requests?
>>>
>>>
>>>
>>> On Wed, Apr 11, 2012 at 11:32 AM, Sean Cribbs <sean at basho.com> wrote:
>>>
>>> Ahmed,
>>>
>>>
>>> I think you'll find this resource useful, it contains some examples of how
>>>
>>> to use
>>>
>>> PBClusterConfig: https://github.com/basho/riak-java-client/wiki/ClientFactory
>>>
>>>
>>> On Wed, Apr 11, 2012 at 2:29 PM, Ahmed Bashir <ahmed.m.bashir at gmail.com>
>>>
>>> wrote:
>>>
>>>
>>> Hey guys,
>>>
>>>
>>> I currently have an app that uses the RiakClient/RiakObject interface
>>>
>>> (fetch(),store(),etc) in lieu of the
>>>
>>> IRiakClient/IRiakObject/FetchObject interface.
>>>
>>>
>>> Is there any way for me to continue using my code with
>>>
>>> PBClusterConfig?  It looks like I need to move to using IRiakClient in
>>>
>>> order to take advantage of PBClusterConfig, is that so?
>>>
>>>
>>> Any insight would be appreciated, thanks!
>>>
>>>
>>> Ahmed
>>>
>>>
>>> _______________________________________________
>>>
>>> riak-users mailing list
>>>
>>> riak-users at lists.basho.com
>>>
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Sean Cribbs <sean at basho.com>
>>>
>>> Software Engineer
>>>
>>> Basho Technologies, Inc.
>>>
>>> http://basho.com/
>>>
>>>
>>>
>>> _______________________________________________
>>> riak-users mailing list
>>> riak-users at lists.basho.com
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>
>>>
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list