Skip to content

Commit

Permalink
Update to vertx-ext-parent 25
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Feb 19, 2017
1 parent da3c4b1 commit 002a769
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 785 deletions.
7 changes: 1 addition & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.vertx</groupId>
<artifactId>vertx-ext-parent</artifactId>
<version>24</version>
<version>25</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -62,11 +62,6 @@
<artifactId>vertx-lang-ruby</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-lang-ceylon</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rx-java</artifactId>
Expand Down
6 changes: 2 additions & 4 deletions src/main/asciidoc/groovy/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add the following dependency to your maven project
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rabbitmq-client</artifactId>
<version>3.4.0.Beta1</version>
<version>3.4.0-SNAPSHOT</version>
</dependency>
----

Expand All @@ -26,7 +26,7 @@ Add the following dependency to your gradle project
[source,groovy,subs="+attributes"]
----
dependencies {
compile 'io.vertx:vertx-rabbitmq-client:3.4.0.Beta1'
compile 'io.vertx:vertx-rabbitmq-client:3.4.0-SNAPSHOT'
}
----

Expand All @@ -36,7 +36,6 @@ You can create a client instance as follows using a full amqp uri:

[source,groovy]
----
import io.vertx.rabbitmq.RabbitMQClient
def config = [:]
// full amqp uri
config.uri = "amqp://xvjvsrrc:VbuL1atClKt7zVNQha0bnnScbNvGiqgb@moose.rmq.cloudamqp.com/xvjvsrrc"
Expand All @@ -48,7 +47,6 @@ Or you can also specify individual parameters manually:

[source,groovy]
----
import io.vertx.rabbitmq.RabbitMQClient
def config = [:]
// Each parameter is optional
// The default parameter with be used if the parameter is not set
Expand Down
4 changes: 2 additions & 2 deletions src/main/asciidoc/java/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add the following dependency to your maven project
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rabbitmq-client</artifactId>
<version>3.4.0.Beta1</version>
<version>3.4.0-SNAPSHOT</version>
</dependency>
----

Expand All @@ -26,7 +26,7 @@ Add the following dependency to your gradle project
[source,groovy,subs="+attributes"]
----
dependencies {
compile 'io.vertx:vertx-rabbitmq-client:3.4.0.Beta1'
compile 'io.vertx:vertx-rabbitmq-client:3.4.0-SNAPSHOT'
}
----

Expand Down
4 changes: 2 additions & 2 deletions src/main/asciidoc/js/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add the following dependency to your maven project
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rabbitmq-client</artifactId>
<version>3.4.0.Beta1</version>
<version>3.4.0-SNAPSHOT</version>
</dependency>
----

Expand All @@ -26,7 +26,7 @@ Add the following dependency to your gradle project
[source,groovy,subs="+attributes"]
----
dependencies {
compile 'io.vertx:vertx-rabbitmq-client:3.4.0.Beta1'
compile 'io.vertx:vertx-rabbitmq-client:3.4.0-SNAPSHOT'
}
----

Expand Down
188 changes: 188 additions & 0 deletions src/main/asciidoc/kotlin/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
= RabbitMQ Client for Vert.x

A Vert.x client allowing applications to interact with a RabbitMQ broker (AMQP 0.9.1)

**This service is experimental and the APIs are likely to change before settling down.**

== Getting Started

=== Maven

Add the following dependency to your maven project

[source,xml,subs="+attributes"]
----
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rabbitmq-client</artifactId>
<version>3.4.0-SNAPSHOT</version>
</dependency>
----

=== Gradle

Add the following dependency to your gradle project

[source,groovy,subs="+attributes"]
----
dependencies {
compile 'io.vertx:vertx-rabbitmq-client:3.4.0-SNAPSHOT'
}
----

=== Create a client

You can create a client instance as follows using a full amqp uri:

[source,kotlin]
----
var config = json {
obj()
}
// full amqp uri
config.put("uri", "amqp://xvjvsrrc:VbuL1atClKt7zVNQha0bnnScbNvGiqgb@moose.rmq.cloudamqp.com/xvjvsrrc")
var client = RabbitMQClient.create(vertx, config)
----

Or you can also specify individual parameters manually:

[source,kotlin]
----
var config = json {
obj()
}
// Each parameter is optional
// The default parameter with be used if the parameter is not set
config.put("user", "user1")
config.put("password", "password1")
config.put("host", "localhost")
config.put("port", 5672)
config.put("virtualHost", "vhost1")
config.put("connectionTimeout", 60)
config.put("requestedHeartbeat", 60)
config.put("handshakeTimeout", 60)
config.put("requestedChannelMax", 5)
config.put("networkRecoveryInterval", 5)
config.put("automaticRecoveryEnabled", true)
var client = RabbitMQClient.create(vertx, config)
----

=== Declare exchange with additional config

You can pass additional config parameters to RabbitMQ's exchangeDeclare method

[source, kotlin]
----
var config = mutableMapOf<String, Any?>()
config["x-dead-letter-exchange"] = "my.deadletter.exchange"
config["alternate-exchange"] = "my.alternate.exchange"
// ...
client.exchangeDeclare("my.exchange", "fanout", true, false, config, { onResult ->
if (onResult.succeeded()) {
println("Exchange successfully declared with config")
} else {
onResult.cause().printStackTrace()
}
})
----

== Operations

The following are some examples of the operations supported by the RabbitMQService API.

Consult the javadoc/documentation for detailed information on all API methods.

=== Publish

Publish a message to a queue

[source,kotlin]
----
var message = json {
obj("body" to "Hello RabbitMQ, from Vert.x !")
}
client.basicPublish("", "my.queue", message, { pubResult ->
if (pubResult.succeeded()) {
println("Message published !")
} else {
pubResult.cause().printStackTrace()
}
})
----

=== Consume

Consume messages from a queue

[source,kotlin]
----
// Create the event bus handler which messages will be sent to
// Create the event bus handler which messages will be sent to
vertx.eventBus().consumer<Any>("my.address", { msg ->
var json = msg.body()
println("Got message: ${json.getString("body")}")
})
// Setup the link between rabbitmq consumer and event bus address
client.basicConsume("my.queue", "my.address", { consumeResult ->
if (consumeResult.succeeded()) {
println("RabbitMQ consumer created !")
} else {
consumeResult.cause().printStackTrace()
}
})
----

=== Get

Will get a message from a queue

[source,kotlin]
----
client.basicGet("my.queue", true, { getResult ->
if (getResult.succeeded()) {
var msg = getResult.result()
println("Got message: ${msg.getString("body")}")
} else {
getResult.cause().printStackTrace()
}
})
----

=== Consume messages without auto-ack

[source,kotlin]
----
// Create the event bus handler which messages will be sent to
vertx.eventBus().consumer<Any>("my.address", { msg ->
var json = msg.body()
println("Got message: ${json.getString("body")}")
// ack
client.basicAck(json.getLong("deliveryTag"), false, { asyncResult ->
})
})
// Setup the link between rabbitmq consumer and event bus address
client.basicConsume("my.queue", "my.address", false, { consumeResult ->
if (consumeResult.succeeded()) {
println("RabbitMQ consumer created !")
} else {
consumeResult.cause().printStackTrace()
}
})
----

== Running the tests

You will need to have RabbitMQ installed and running with default ports on localhost for this to work.
<a href="mailto:nscavell@redhat.com">Nick Scavelli</a>
4 changes: 2 additions & 2 deletions src/main/asciidoc/ruby/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add the following dependency to your maven project
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rabbitmq-client</artifactId>
<version>3.4.0.Beta1</version>
<version>3.4.0-SNAPSHOT</version>
</dependency>
----

Expand All @@ -26,7 +26,7 @@ Add the following dependency to your gradle project
[source,groovy,subs="+attributes"]
----
dependencies {
compile 'io.vertx:vertx-rabbitmq-client:3.4.0.Beta1'
compile 'io.vertx:vertx-rabbitmq-client:3.4.0-SNAPSHOT'
}
----

Expand Down

This file was deleted.

Loading

0 comments on commit 002a769

Please sign in to comment.