Skip to content
The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmarks/src/jmh Merge pull request #146 from viartemev/add-main-example Mar 13, 2019
gradle/wrapper
src Fix test Mar 20, 2019
the-white-rabbit-example/src/main Improve consumer Mar 13, 2019
the-white-rabbit-ktor-example
the-white-rabbit-spring-boot-example/src/main
the-white-rabbit-vertx-example/src/main/kotlin/com/viartemev/the_white_rabbit_vertx_example
.editorconfig
.gitignore Add logback & change params for JHM Mar 7, 2019
.travis.yml
LICENSE Create LICENSE Feb 7, 2019
README.md Update docs Mar 13, 2019
build.gradle Add test for publisher Mar 19, 2019
gradle.properties Fix spring project Mar 5, 2019
gradlew
gradlew.bat
settings.gradle

README.md

The White Rabbit

Build Status Download Open Source Helpers codecov License: MIT Gitter

The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines

Benchmarks

Adding to project:

Gradle:
repositories {
    jcenter()
}

compile 'com.viartemev:the-white-rabbit:$version'
Maven:
<repositories>
    <repository>
        <id>jcenter</id>
        <url>https://jcenter.bintray.com/</url>
    </repository>
</repositories>

<dependency>
  <groupId>com.viartemev</groupId>
  <artifactId>the-white-rabbit</artifactId>
  <version>${version}</version>
</dependency>

Usage:

- Async message publishing with confirmation:
connection.confirmChannel {
    publish {
        val messages = (1..n).map { createMessage("Hello #$it") }
        publishWithConfirmAsync(coroutineContext, messages).awaitAll()
    }
}

or

connection.confirmChannel {
     publish {
        coroutineScope {
            val messages = (1..n).map { createMessage("Hello #$it") }
            messages.map { async { publishWithConfirm(it) } }
        }
    }
}
- Async message consuming with acknowledge:

Consume only n-messages:

connection.channel {
    consume(QUEUE_NAME, PREFETCH_COUNT) {
        (1..n).map { async { consumeMessageWithConfirm({ println(it) }) } }.awaitAll()
    }
}
- Async exchange declaration:
channel.declareExchange(ExchangeSpecification(EXCHANGE_NAME))
- Async queue declaration:
channel.declareQueue(QueueSpecification(QUEUE_NAME))
- Async queue binding to an exchange:
channel.bindQueue(BindQueueSpecification(EXCHANGE_NAME, QUEUE_NAME))
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.