Download Maven Central

RxRabbit

RxRabbit is a RabbitMQ java 8 client library that extends and enhances the rabbitmq-java-client by providing a resilient, auto-connecting ReactiveX styled API.

Highlights

Getting started

Have a look at the RxRabbit Tutorial to get a feel for how to use the API in a real application.

You can also look at the integration tests and the ExampleCode class.

The javadoc of the core API classes and interfaces is also a good source of reference.

Download dependencies

Gradle:

    compile 'com.meltwater:rxrabbit:$RXRABBIT_VERSION'   

Maven:

    <dependency>
        <groupId>com.meltwater</groupId>
        <artifactId>rxrabbit</artifactId>
        <version>$RXRABBIT_VERSION</version>
        <type>jar</type>
    </dependency>

Design Philosophy

Opinionated API

The API has strong opinions on how RabbitMQ should be used. It hides a lot of functionality from the Channel interface and also introduces a concept of channel types that are made for a specific purpose (such as publish, consume or admin operations). This means of course that there are several things that you can't do with this api, but keep in mind that it is a conscious decision made by the API developers.

Main supported use cases by rxrabbit:

Error handling and recovery

The official rabbitmq Java client provides some basic but non-complete error handling and recovery mechanisms. A number of wrapper libraries already exists today which, with varying success, automatically handles connection recovery in more error scenarios than the official java client. The best ones we have found so far were Spring-amqp which we discovered suffered from excessive and erroneous channel handling, and lyra which, in our view, implements and overly complex error handling logic that still has issues with recovering from some extreme error cases, such as hard broker restarts.

RxRabbit instead uses a very basic but effective approach when it comes to error handling and recovery:

No matter the error, the code assumes that the connection is broken then attempts to re-connect to the broker with exponential back-off

The goal we have is that consumers and producers should not have to care about the underlying rabbit channels and connections. Re-connects should remain hidden from the API user unless specifically asked for (currently achieved by adding listeners).

Building locally

Pre-requisites

Build (including running the tests) by running

./gradlew clean build

Also note that it is currently NOT supported to run the test on OSX using docker machine, you need to be able to connect to docker containers using localhost:.

How to contribute

We happily accept contributions in the form of Github PRs or in the form of bug reports, comments/suggestions or usage questions by creating a github issue.

Notes on project maturity

This library was developed as an Meltwater internal project starting in October 2015. Over the past year it has been battle tested in production by an (ever increasing) majority of our jvm based components and is now an integral part of our technology stack.

License

The MIT License (MIT)

Copyright (c) 2016 Meltwater Inc. http://underthehood.meltwater.com/