Skip to content

Commit

Permalink
Merge branch '3.4.0-staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoffier committed Mar 7, 2017
2 parents 2a38cad + 149f66e commit 774eb81
Show file tree
Hide file tree
Showing 736 changed files with 15,207 additions and 1,815 deletions.
29 changes: 26 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use that as a template for setting up a Maven project with Vert.x.

Progress to the link:maven-verticles/maven-verticle[simple Maven verticle example] to show you how to deploy your code as verticles in a Maven project. Also check link:maven-verticles[Maven verticles examples] to show how you can use Maven with Groovy, Ruby and JavaScript verticles.

Want to start right away, open the first example in Eclipse Che:
Want to start right away, open the first example in Eclipse Che:

image:http://beta.codenvy.com/factory/resources/codenvy-contribute.svg["Open workspace in Eclipse Che", link="http://beta.codenvy.com/f?id=9skz1321dxbqpj5j"]

Expand Down Expand Up @@ -135,13 +135,31 @@ Vert.x-Web is a toolkit for building web applications using Vert.x

The link:web-examples/README.adoc[Vert.x-Web examples] contains a wide range of examples using Vert.x-Web

=== Vertx unit examples
=== Vert.x Web Client examples

Vertx-unit is a toolkit for writing asynchronous tests. We include some examples of how to use this tool to test
Vert.x Web Client that provides an easy to use web client for Vert.x.

The link:web-client-examples/README.adoc[Vert.x Web Client examples] contains a wide range of examples using the Vert.x Web Client

=== Vertx Unit examples

Vertx-Unit is a library for writing asynchronous tests. We include some examples of how to use this tool to test
your Vert.x (or other asynchronous) applications.

The link:unit-examples/README.adoc[Vert.x Unit examples] shows how to use Vert.x Unit.

=== RxJava examples

Vert.x for RxJava provides most of its APIs as RxJava so you can use those if you prefer.

RxJava is a great choice when you want to perform complex operations on multiple asynchronous streams of data.

The link:rx-examples/README.adoc[Vert.x RxJava examples] contains a wide range of examples using Vert.x for RxJava

=== gRPC examples

The link:grpc-examples/README.adoc[Vert.x gRPC Examples] show how you can implement a gRPC service and invoke a gRPC service with Vert.x.

=== Mail examples

The link:mail-examples/README.adoc[Vert.x Mail examples]
Expand Down Expand Up @@ -198,6 +216,11 @@ The link:mongo-examples/README.adoc[Vert.x Mongo Example] shows how you can inte
The link:jdbc-examples/README.adoc[Vert.x JDBC Examples] shows how you can interact JDBC Databases using the vert.x JDBC
client.

=== Kafka example

The link:kafka-examples/README.adoc[Vert.x Kafka Examples] shows how you can interact Kafka using the vert.x Kafka
client.

=== JCA example

The Vert.x JCA Example project provides a JEE compliant application that enables to you deploy the application into a
Expand Down
4 changes: 2 additions & 2 deletions amqp-bridge-examples/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ link:src/main/js/io/vertx/example/amqp/receiver.js[JavaScript message receiver]
link:src/main/js/io/vertx/example/amqp/sender.js[JavaScript message sender] +
link:src/main/groovy/io/vertx/example/amqp/receiver.groovy[Groovy message receiver] +
link:src/main/groovy/io/vertx/example/amqp/sender.groovy[Groovy message sender] +
link:src/main/rb/io/vertx/example/amqp/receiver.rb[Ruby message receiver] +
link:src/main/rb/io/vertx/example/amqp/sender.rb[Ruby message sender]
link:src/main/ruby/io/vertx/example/amqp/receiver.rb[Ruby message receiver] +
link:src/main/ruby/io/vertx/example/amqp/sender.rb[Ruby message sender]
4 changes: 2 additions & 2 deletions amqp-bridge-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.vertx</groupId>
<artifactId>amqp-bridge-examples</artifactId>
<version>3.3.3</version>
<version>3.4.0</version>

<dependencies>
<!-- primary deps -->
Expand Down Expand Up @@ -59,7 +59,7 @@
<repositories>
<repository>
<id>staging</id>
<url>https://oss.sonatype.org/content/repositories/iovertx-3295</url>
<url>https://oss.sonatype.org/content/repositories/iovertx-3671/</url>
</repository>
</repositories>
</profile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import io.vertx.groovy.amqpbridge.AmqpBridge
import io.vertx.amqpbridge.AmqpBridge as AmqpBridge

def bridge = AmqpBridge.create(vertx)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import groovy.transform.Field
import io.vertx.groovy.amqpbridge.AmqpBridge
import io.vertx.amqpbridge.AmqpBridge as AmqpBridge

def bridge = AmqpBridge.create(vertx)
@Field def count = 1
Expand Down
6 changes: 3 additions & 3 deletions camel-bridge-examples/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Launch it by running the `main` method in your IDE or, after having build the pr


----
java -jar target/camel-bridge-examples-3.3.3.jar run io.vertx.example.camel.feed.FeedExample
java -jar target/camel-bridge-examples-3.4.0.jar run io.vertx.example.camel.feed.FeedExample
----

== RMI example
Expand All @@ -45,7 +45,7 @@ This example demonstrates:
Launch it by running the `main` method in your IDE , after having build the project with `mvn clean package`, with:

----
java -jar target/camel-bridge-examples-3.3.3.jar run io.vertx.example.camel.rmi.RMIExample
java -jar target/camel-bridge-examples-3.4.0.jar run io.vertx.example.camel.rmi.RMIExample
----

Then open your browser to: `http://localhost:8080/?name=world`
Then open your browser to: `http://localhost:8080/?name=world`
6 changes: 3 additions & 3 deletions camel-bridge-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.vertx</groupId>
<artifactId>camel-bridge-examples</artifactId>
<version>3.3.3</version>
<version>3.4.0</version>

<dependencies>
<dependency>
Expand Down Expand Up @@ -101,9 +101,9 @@
<repositories>
<repository>
<id>staging</id>
<url>https://oss.sonatype.org/content/repositories/iovertx-3295</url>
<url>https://oss.sonatype.org/content/repositories/iovertx-3671/</url>
</repository>
</repositories>
</profile>
</profiles>
</project>
</project>
7 changes: 4 additions & 3 deletions circuit-breaker-examples/codetrans-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"excludes": [


// only the ruby code is invalid (too many lambdas)
// the ruby code is invalid (too many lambdas)
// the kotlin code is invalid (future)
{
"package": "io.vertx.example.circuit.breaker",
"langs": ["rb"]
"langs": ["rb", "kotlin"]
}

]
}
}
6 changes: 3 additions & 3 deletions circuit-breaker-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.vertx</groupId>
<artifactId>circuit-breaker-examples</artifactId>
<version>3.3.3</version>
<version>3.4.0</version>

<build>
<plugins>
Expand Down Expand Up @@ -52,10 +52,10 @@
<repositories>
<repository>
<id>staging</id>
<url>https://oss.sonatype.org/content/repositories/iovertx-3295</url>
<url>https://oss.sonatype.org/content/repositories/iovertx-3671/</url>
</repository>
</repositories>
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import io.vertx.groovy.circuitbreaker.CircuitBreaker
import io.vertx.circuitbreaker.CircuitBreaker
def options = [
maxFailures:5,
timeout:5000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.vertx.example.circuit.breaker

import io.vertx.circuitbreaker.CircuitBreaker
import io.vertx.circuitbreaker.CircuitBreakerOptions
import io.vertx.kotlin.circuitbreaker.*

class Client : io.vertx.core.AbstractVerticle() {
override fun start() {
var options = CircuitBreakerOptions(
maxFailures = 5,
timeout = 5000,
fallbackOnFailure = true)

var breaker = CircuitBreaker.create("my-circuit-breaker", vertx, options).openHandler({ v ->
println("Circuit opened")
}).closeHandler({ v ->
println("Circuit closed")
})

var result = breaker.executeWithFallback({ future ->
vertx.createHttpClient().getNow(8080, "localhost", "/", { response ->
if (response.statusCode() != 200) {
future.fail("HTTP error")
} else {
response.exceptionHandler({ future.fail(it) }).bodyHandler({ buffer ->
future.complete(buffer.toString())
})
}
})
}, { v ->
// Executed when the circuit is opened
return "Hello (fallback)"
})

result.setHandler({ ar ->
// Do something with the result
println("Result: ${ar.result()}")
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.vertx.example.circuit.breaker


class Server : io.vertx.core.AbstractVerticle() {
override fun start() {
vertx.createHttpServer().requestHandler({ req ->
req.response().end("Bonjour")
}).listen(8080)
}
}
21 changes: 21 additions & 0 deletions consul-examples/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
= Vert.x Consul Client examples

== Start Consul instance

To run this example, you need a running Consul instance

[source,bash]
----
consul agent -data-dir=/tmp/kekeke -server -ui -bootstrap=1
----

== Languages

The example is available in several languages:

* Java: link:src/main/java/io/vertx/examples/consul/ConsulClientVerticle.java[ConsulClientVerticle.java]
* Kotlin: link:src/main/kotlin/io/vertx/examples/consul/ConsulClientVerticle.kt[ConsulClientVerticle.kt]
* JavaScript: link:src/main/js/io/vertx/examples/consul/consul_client_verticle.js[consul_client_verticle.js]
* Groovy: link:src/main/groovy/io/vertx/examples/consul/consul_client_verticle.groovy[consul_client_verticle.groovy]
* Ruby: link:src/main/ruby/io/vertx/examples/consul/consul_client_verticle.rb[consul_client_verticle.rb]

60 changes: 60 additions & 0 deletions consul-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.vertx</groupId>
<artifactId>consul-examples</artifactId>
<version>3.4.0</version>

<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-consul-client</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.vertx</groupId>
<artifactId>examples-utils</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Acodetrans.output=${project.basedir}/src/main</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>staging</id>
<repositories>
<repository>
<id>staging</id>
<url>https://oss.sonatype.org/content/repositories/iovertx-3671/</url>
</repository>
</repositories>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import io.vertx.ext.consul.ConsulClient
def consulClient = ConsulClient.create(vertx)
consulClient.putValue("key11", "value11", { putResult ->
if (putResult.succeeded()) {
println("KV pair saved")
consulClient.getValue("key11", { getResult ->
if (getResult.succeeded()) {
println("KV pair retrieved")
println(getResult.result().value)
} else {
getResult.cause().printStackTrace()
}
})
} else {
putResult.cause().printStackTrace()
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.vertx.examples.consul;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.ext.consul.ConsulClient;

/**
* @author <a href="mailto:[email protected]">Ruslan Sennov</a>
*/
public class ConsulClientVerticle extends AbstractVerticle {

/**
* Convenience method so you can run it in your IDE
*/
public static void main(String[] args) {
Launcher.main(new String[]{"run", ConsulClientVerticle.class.getName()});
}


@Override
public void start() throws Exception {
ConsulClient consulClient = ConsulClient.create(vertx);
consulClient.putValue("key11", "value11", putResult -> {
if (putResult.succeeded()) {
System.out.println("KV pair saved");
consulClient.getValue("key11", getResult -> {
if (getResult.succeeded()) {
System.out.println("KV pair retrieved");
System.out.println(getResult.result().getValue());
} else {
getResult.cause().printStackTrace();
}
});
} else {
putResult.cause().printStackTrace();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var ConsulClient = require("vertx-consul-js/consul_client");
var consulClient = ConsulClient.create(vertx);
consulClient.putValue("key11", "value11", function (putResult, putResult_err) {
if (putResult_err == null) {
console.log("KV pair saved");
consulClient.getValue("key11", function (getResult, getResult_err) {
if (getResult_err == null) {
console.log("KV pair retrieved");
console.log(getResult.value);
} else {
getResult_err.printStackTrace();
}
});
} else {
putResult_err.printStackTrace();
}
});
Loading

0 comments on commit 774eb81

Please sign in to comment.