2. 1. Résumé rapide de Reactive Streams
2. Introduction à RSocket
3. Différent types d’interactions client/serveur
4. Ingrédients principaux de RSocket
5. Différentiateurs
6. Regard rapide sur les APIs Java
7. Conclusion
Plan
62. //extract count, interval and unit from payload
return Flux.interval(interval, unit)
.take(count)
.map(i -> i %2 == 0 ?
DefaultPayload.create("tick") :
DefaultPayload.create("tock")
);
Server Side
65. Flux<Payload> flux = Flux.create(sink -> {
//repeatedly get durations using input box
// as “count UNIT” (eg. “500 MILLIS”)
// and send these, “STOP” sends “0 MILLIS”...
});
rSocket.requestChannel(flux)
.map(Payload::getDataUtf8)
.doOnNext(msg ->
System.out.println("stream-stream: " + msg)
.blockLast();
Client Side
66. return Flux.from(payloads)
.switchMap(event -> {
//extract count, interval and unit
//from event Payload
return Flux.interval(interval, unit)
.take(count)
.map(i -> i %2 == 0 ?
DefaultPayload.create("tick") :
DefaultPayload.create("tock")
);
});
Server Side
67. logs on client side:
stream-stream 100x every 2 SECONDS
stream-stream tick
stream-stream 100x every 500 MILLIS
stream-stream tick
stream-stream tock
stream-stream STOPPING
logs on server side:
100, every 2 SECONDS
100, every 500 MILLIS
0, every 0 SECONDS