Reading Time: 4 minutes

Who doesn’t know about Redis? It’s harder and harder to find someone giving a positive answer to this question as the popularity of this key/value store is constantly increasing. With an extensive support for diverse data structures, file-based persistence, a publish/subscribe engine and an upcoming (and highly anticipated) support for clustering, it is indeed not surprising to find Redis running in more and more environments.

Therefore, we’re happy to announce the first release of the Redis Connector for Mule. Read on to see all the cool things Mule and Redis can do together…

latest report
Learn why we are the Leaders in API management and iPaaS

Let’s do a quick tour of the different features of the Redis Connector. You can find the complete user guide on Muleforge.

Connectivity

Connecting Mule to a local non-password protected Redis running on its standard port is as simple as:

Behind the scene, the connector relies on Jedis for protocol handling and connection pooling. The complete range of options, including the configuration of a custom pool, is shown hereafter:

With the connection established to Redis, it’s now time to read and write data.

Data structure operations

The connector supports operations on Redis’ stringshasheslistssets and sorted sets. The following showcases a few commands with some of their attributes shown:

Publish / Subscribe

Redis not only excels at data structures, it also offers a no-fluff pub/sub engine. Mule can both publish and subscribe to Redis channels, as demonstrated below:

Mule data persistence

Through the connector, Mule can directly leverage Redis to persist its internal data. In fact, components like the until-successful router or the PubSubHubbub module rely on the pluggable object store infrastructure that exists in Mule.

The following shows a (previously shown) example of until-successful modified to use Redis as its object store:

Give it a try

Add the MuleForge repository  to your POM file:

Then add the connector as a dependency:

Finally, add the redis namespace declarations in your Mule XML configuration file:

And off you go, your Mule is Redis-ready!

Missing something?

Redis exposes numerous operations on its different data structures: this first version of the Mule Connector doesn’t expose them all. If you’re missing one please let us know, either in a comment below or on GitHub.

Follow: @rossmason@mulejockey