### Riak EntityStore

code

docs

tests

EntityStore service backed by a Riak bucket.

The EntityStore comes in two flavours: HTTP or ProtocolBuffer based. See the Riak documentation.

Table 69. Artifact

Group ID | Artifact ID | Version
--- | --- | ---
org.qi4j.extension | org.qi4j.extension.entitystore-riak | 2.1

#### Assembly

Assembly is done using the provided Assemblers.

For HTTP based Riak client:

    public void assemble( ModuleAssembly module )
        throws AssemblyException
    {
    [...snip...]

        new RiakHttpMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
    }

For ProtocolBuffer based Riak client:

    public void assemble( ModuleAssembly module )
        throws AssemblyException
    {
    [...snip...]

        new RiakProtobufMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
    }

#### Configuration

Here are the configuration properties for the HTTP based Riak client:

    public interface RiakHttpEntityStoreConfiguration
            extends ConfigurationComposite
    {

        /**
         * List of Riak URLs.
         *
         * Defaulted to http://127.0.0.1:8098/riak if empty.
         */
        @UseDefaults
        Property<List<String>> urls();

        /**
         * Riak Bucket where Entities state will be stored.
         *
         * Defaulted to "qi4j:entities".
         */
        @Optional
        Property<String> bucket();

        /**
         * Maximum total connections.
         *
         * Defaulted to 50. Use 0 for infinite number of connections.
         */
        @Optional
        Property<Integer> maxConnections();

        /**
         * The connection, socket read and pooled connection acquisition timeout in milliseconds.
         *
         * Defaulted to 0 (infinite).
         */
        @UseDefaults
        Property<Integer> timeout();

    }

Here are the configuration properties for the ProtocolBuffer based Riak client:

    public interface RiakProtobufEntityStoreConfiguration
        extends ConfigurationComposite
    {

        /**
         * List of Riak Protocol Buffer hosts.
         *
         * Each entry can contain either an IP address / hostname
         * or an IP address / hostname followed by a column and the host's port.
         *
         * Defaulted to 127.0.0.1 if empty.
         */
        @UseDefaults
        Property<List<String>> hosts();

        /**
         * Riak Bucket where Entities state will be stored.
         *
         * Defaulted to "qi4j:entities".
         */
        @Optional
        Property<String> bucket();

        /**
         * Maximum total connections.
         *
         * Defaulted to 50. Use 0 for infinite number of connections.
         */
        @Optional
        Property<Integer> maxConnections();

        /**
         * The connection timeout in milliseconds.
         *
         * Defaulted to 1000.
         */
        @Optional
        Property<Integer> connectionTimeout();

        /**
         * Idle connection time to live in milliseconds.
         *
         * Defaulted to 1000.
         */
        @Optional
        Property<Integer> idleConnectionTTL();

        /**
         * Max pool size.
         *
         * Defaulted to 0 (unlimited).
         */
        @UseDefaults
        Property<Integer> maxPoolSize();

        /**
         * Initial pool size.
         *
         * Defaulted to 0.
         */
        @UseDefaults
        Property<Integer> initialPoolSize();

        /**
         * Socket buffer size in KB.
         *
         * Defaulted to 16.
         */
        @Optional
        Property<Integer> socketBufferSizeKb();

    }