Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The Key-Value store API provides a minimum set of operations that are needed by the Blueriq Runtime in order to interact with a generic key-value store. It also enhances the Blueriq Runtime to be able to run in a clustered configuration.

A default implementation of the Key-Value Store API based on Redis is provided by Blueriq, named Redis Key-Value Store Component.

This article chapter describes how to enable the default component and how to add a custom implementation for a key value store.

Table of Contents

Redis Key-Value Store Component

Enable/Disable

In order to enable the component, the profile "keyvalue-redis-store" profile must be added in the bootstrap.properties

Code Block
spring.profiles.active=native,keyvalue-redis-store

Properties

PropertyDescriptionRequiredDefault Value
blueriq.keyvalue-redis-store.connection.host-nameThe DNS name or IP address of the Redis serverTRUE 
blueriq.keyvalue-redis-store.connection.portThe port on which to connect to RedisFALSE6379
blueriq.keyvalue-redis-store.connection.passwordThe password used to connect to Redis. Can be left empty if no password is required.FALSE 
blueriq.keyvalue-redis-store.connection.test-while-idleWhether connections in the Redis connection pool should be tested while idleFALSEFALSE
blueriq.keyvalue-redis-store.min-evictable-idle-time-millisMinimum amount of time a Redis connection may sit idle in the connection pool before being eligible for evictionFALSE60000
blueriq.keyvalue-redis-store.time-between-eviction-runs-millisAmount of time between eviction runs. If set to a non-positive value, no eviction runs will occur.FALSE30000
blueriq.keyvalue-redis-store.num-tests-per-eviction-runThe maximum number of connections to examine during an evicition run. If the value negative, roughtly 1/abs(value) connections will be examined.FALSE-1

 

The following example configuration connects the Runtime to a Redis instance running on localhost on the default port and using a password:

Code Block
blueriq.keyvalue-redis-store.connection.host-name=localhost
blueriq.keyvalue-redis-store.connection.password=example

 

Custom implementation plug-in

Blueriq provides an IKeyValueStore interface which can be used to interact with a generic key-value store. In order to use this interface, add blueriq-component-api to your project's dependencies:

Code Block
<dependency>
  <groupId>com.blueriq</groupId>
  <artifactId>blueriq-component-api</artifactId>
  <version>${blueriq.version}</version>
</dependency>