=== Redis backend

The service discovery has a plug-able backend using the `link:unavailable[ServiceDiscoveryBackend]` SPI. This is an implementation of the SPI based
on Redis.

==== Using the Redis backend

To use the Redis backend, add the following dependency to the _dependencies_ section of your build
descriptor:

* Maven (in your `pom.xml`):

[source,xml,subs="+attributes"]
----
<dependency>
 <groupId>io.vertx</groupId>
 <artifactId>vertx-service-discovery-backend-redis</artifactId>
 <version>3.9.12</version>
</dependency>
----

* Gradle (in your `build.gradle` file):

[source,groovy,subs="+attributes"]
----
compile 'io.vertx:vertx-service-discovery-backend-redis:3.9.12'
----

Be aware that you can have only a single implementation of the SPI in your _classpath_. If none,
the default backend is used.

==== Configuration

The backend is based on the http://vertx.io/docs/vertx-redis-client/java[vertx-redis-client].
The configuration is the client configuration as well as `key` indicating in which _key_ on Redis
the records are stored.

Here is an example:

[source,ruby]
----
require 'vertx-service-discovery/service_discovery'
VertxServiceDiscovery::ServiceDiscovery.create(vertx, {
  'backendConfiguration' => {
    'host' => "127.0.0.1",
    'key' => "records"
  }
})

----

It's important to note that the backend configuration is passed in the `setBackendConfiguration` method (or
`backendConfiguration` entry if you use JSON):

[source,ruby]
----
require 'vertx-service-discovery/service_discovery'
VertxServiceDiscovery::ServiceDiscovery.create(vertx, {
  'backendConfiguration' => {
    'host' => "localhost",
    'port' => 1234,
    'key' => "my-records"
  }
})

----