Skip to content

Commit ca1deab

Browse files
committed
Related to vert-x3#247
Renamed modules Fix links Update code to use Flowable
1 parent db21f88 commit ca1deab

File tree

66 files changed

+95
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+95
-91
lines changed

rx-examples/README.adoc renamed to rxjava-1-examples/README.adoc

+3-1

rx-examples/pom.xml renamed to rxjava-1-examples/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>io.vertx</groupId>
8-
<artifactId>rx-examples</artifactId>
8+
<artifactId>rx-java1-examples</artifactId>
99
<version>3.5.0</version>
1010

1111
<dependencies>

rxjava2-examples/pom.xml renamed to rxjava-2-examples/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>io.vertx</groupId>
8-
<artifactId>rxjava2-examples</artifactId>
8+
<artifactId>rxjava-2-examples</artifactId>
99
<version>3.5.0</version>
1010

1111
<dependencies>

rxjava2-examples/src/main/java/io/vertx/example/reactivex/database/mongo/Client.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/database/mongo/Client.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.vertx.example.reactivex.database.mongo;
22

3-
import io.reactivex.Observable;
3+
import io.reactivex.Flowable;
44
import io.vertx.core.json.JsonObject;
55
import io.vertx.example.util.Runner;
66
import io.vertx.reactivex.core.AbstractVerticle;
@@ -43,7 +43,7 @@ public void start() throws Exception {
4343

4444
private void insertAndFind() {
4545
// Documents to insert
46-
Observable<JsonObject> documents = Observable.just(
46+
Flowable<JsonObject> documents = Flowable.just(
4747
new JsonObject().put("username", "temporalfox").put("firstname", "Julien").put("password", "bilto"),
4848
new JsonObject().put("username", "purplefox").put("firstname", "Tim").put("password", "wibble")
4949
);
@@ -52,7 +52,7 @@ private void insertAndFind() {
5252
.rxCreateCollection("users")
5353
.andThen(
5454
// After collection is created we insert each document
55-
documents.flatMap(doc -> mongo.rxInsert("users", doc).toObservable())
55+
documents.flatMap(doc -> mongo.rxInsert("users", doc).toFlowable())
5656
)
5757
.doOnNext(id -> {
5858
System.out.println("Inserted document " + id);

rxjava2-examples/src/main/java/io/vertx/example/reactivex/eventbus/pingpong/PingPong.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/eventbus/pingpong/PingPong.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void start() throws Exception {
1919
EventBus eb = vertx.eventBus();
2020

2121
eb.consumer(ADDRESS)
22-
.toObservable()
22+
.toFlowable()
2323
.subscribe(message -> {
2424
System.out.println("Received " + message.body());
2525
message.reply("PONG");

rxjava2-examples/src/main/java/io/vertx/example/reactivex/eventbus/pubsub/Receiver.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/eventbus/pubsub/Receiver.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public void start() throws Exception {
2020

2121
EventBus eb = vertx.eventBus();
2222

23-
eb.consumer("news-feed").
24-
toObservable().
25-
subscribe(message -> System.out.println("Received news: " + message.body()));
23+
eb.consumer("news-feed")
24+
.toFlowable()
25+
.subscribe(message -> System.out.println("Received news: " + message.body()));
2626

2727
System.out.println("Ready!");
2828
}

rxjava2-examples/src/main/java/io/vertx/example/reactivex/eventbus/zipreplies/Receiver.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/eventbus/zipreplies/Receiver.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public void start() throws Exception {
2424
EventBus eb = vertx.eventBus();
2525

2626
eb.consumer("heatsensor1").
27-
toObservable().
27+
toFlowable().
2828
subscribe(message -> {
2929
message.reply(9 + random1.nextInt(5));
3030
});
3131

3232
eb.consumer("heatsensor2").
33-
toObservable().
33+
toFlowable().
3434
subscribe(message -> {
3535
message.reply(10 + random1.nextInt(3));
3636
});

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/reduce/Client.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/reduce/Client.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package io.vertx.example.reactivex.http.client.reduce;
22

3+
import io.reactivex.Flowable;
34
import io.vertx.core.http.HttpMethod;
45
import io.vertx.example.util.Runner;
56
import io.vertx.reactivex.core.AbstractVerticle;
67
import io.vertx.reactivex.core.buffer.Buffer;
78
import io.vertx.reactivex.core.http.HttpClient;
89
import io.vertx.reactivex.core.http.HttpClientRequest;
9-
import io.reactivex.Observable;
1010

1111
/*
1212
* @author <a href="mailto:[email protected]">Julien Viet</a>
@@ -22,23 +22,23 @@ public static void main(String[] args) {
2222
public void start() throws Exception {
2323
HttpClient client = vertx.createHttpClient();
2424
HttpClientRequest req = client.request(HttpMethod.GET, 8080, "localhost", "/");
25-
req.toObservable().
25+
req.toFlowable().
2626

27-
// Status code check and -> Observable<Buffer>
27+
// Status code check and -> Flowable<Buffer>
2828
flatMap(resp -> {
29-
if (resp.statusCode() != 200) {
30-
throw new RuntimeException("Wrong status code " + resp.statusCode());
31-
}
32-
return Observable.just(Buffer.buffer()).mergeWith(resp.toObservable());
33-
}).
29+
if (resp.statusCode() != 200) {
30+
throw new RuntimeException("Wrong status code " + resp.statusCode());
31+
}
32+
return Flowable.just(Buffer.buffer()).mergeWith(resp.toFlowable());
33+
}).
3434

35-
// Reduce all buffers in a single buffer
35+
// Reduce all buffers in a single buffer
3636
reduce(Buffer::appendBuffer).
3737

38-
// Turn in to a string
38+
// Turn in to a string
3939
map(buffer -> buffer.toString("UTF-8")).
4040

41-
// Get a single buffer
41+
// Get a single buffer
4242
subscribe(data -> System.out.println("Server content " + data));
4343

4444
// End request

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/reduce/Server.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/reduce/Server.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
@Override
1818
public void start() throws Exception {
1919
HttpServer server = vertx.createHttpServer();
20-
server.requestStream().toObservable().subscribe(req -> {
20+
server.requestStream().toFlowable().subscribe(req -> {
2121
req.response().putHeader("content-type", "text/html").end("<html><body><h1>Hello from vert.x!</h1></body></html>");
2222
});
2323
server.listen(8080);

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/simple/Client.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/simple/Client.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ public static void main(String[] args) {
2020
public void start() throws Exception {
2121
HttpClient client = vertx.createHttpClient();
2222
HttpClientRequest req = client.request(HttpMethod.GET, 8080, "localhost", "/");
23-
req.toObservable().
23+
req.toFlowable().
2424

25-
// Status code check and -> Observable<Buffer>
25+
// Status code check and -> Flowable<Buffer>
2626
flatMap(resp -> {
2727
if (resp.statusCode() != 200) {
2828
throw new RuntimeException("Wrong status code " + resp.statusCode());
2929
}
30-
return resp.toObservable();
30+
return resp.toFlowable();
3131
}).
3232

3333
subscribe(data -> System.out.println("Server content " + data.toString("UTF-8")));

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/simple/Server.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/simple/Server.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
@Override
1818
public void start() throws Exception {
1919
HttpServer server = vertx.createHttpServer();
20-
server.requestStream().toObservable().subscribe(req -> {
20+
server.requestStream().toFlowable().subscribe(req -> {
2121
req.response().putHeader("content-type", "text/html").end("<html><body><h1>Hello from vert.x!</h1></body></html>");
2222
});
2323
server.listen(8080);

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/unmarshalling/Client.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/unmarshalling/Client.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ static class Data {
2828
public void start() throws Exception {
2929
HttpClient client = vertx.createHttpClient();
3030
HttpClientRequest req = client.request(HttpMethod.GET, 8080, "localhost", "/");
31-
req.toObservable().
32-
flatMap(HttpClientResponse::toObservable)
31+
req.toFlowable().
32+
flatMap(HttpClientResponse::toFlowable)
3333
.map(buffer -> buffer.toJsonObject().mapTo(Data.class))
3434
.subscribe(
3535
data -> System.out.println("Got response " + data.message));

rxjava2-examples/src/main/java/io/vertx/example/reactivex/http/client/unmarshalling/Server.java renamed to rxjava-2-examples/src/main/java/io/vertx/example/reactivex/http/client/unmarshalling/Server.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
@Override
1818
public void start() throws Exception {
1919
HttpServer server = vertx.createHttpServer();
20-
server.requestStream().toObservable().subscribe(req -> {
20+
server.requestStream().toFlowable().subscribe(req -> {
2121
req.response().putHeader("content-type", "application/json").end("{\"message\":\"Hello World\"}");
2222
});
2323
server.listen(8080);

0 commit comments

Comments
 (0)