2. 自己紹介
水落 啓太(みずおち けいた)
• ヤフー株式会社所属
• 社内PaaS(Pivotal Cloud Foundry)
関連コンポーネントの開発、
社内PaaS利用者向け技術サポートなどに従事
• マイブームはSpring WebFlux
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
2
3. 紹介するセッション
1. Reactor Netty, the Default Spring Boot 2.0 Runtime
– Violeta Georgieva@Pivotal
2. Walking up the Spring for Apache Kafka Stack
– Viktor Gamov@Confluent
– Gary Russell@Pivotal
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
3
4. Reactor Netty, the Default Spring
Boot 2.0 Runtime
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
4
8. Reactor Netty (0.8) Server API
HttpServer.create()
.port(8080)
.protocol(HttpProtocol.HTTP11)
.handle((req, res) ->
...
res.send(resBody)
)
.bindNow();
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
8
Publisher<ByteBuf>
9. Reactor Netty (0.8) Client API
HttpClient.create()
.port(8080)
.protocol(HttpProtocol.HTTP11)
.post()
.uri("http://...")
.send(body)
.responseContent()
.aggregate()
.asString()
.block();
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
9
Publisher<ByteBuf>
10. wiretap
• 通信内容をダンプする機能
HttpClient.create()
.wiretap(true)
...
13:24:36.333 [reactor-http-nio-4] DEBUG reactor.netty.http.client.HttpClient - [id:
0x78ba8f21, L:/172.16.164.183:57134 - R:www.yahoo.co.jp/183.79.250.251:80] WRITE: 113B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a |GET / HTTP/1.1..|
|00000010| 75 73 65 72 2d 61 67 65 6e 74 3a 20 52 65 61 63 |user-agent: Reac|
|00000020| 74 6f 72 4e 65 74 74 79 2f 30 2e 38 2e 32 2e 52 |torNetty/0.8.2.R|
|00000030| 45 4c 45 41 53 45 0d 0a 68 6f 73 74 3a 20 77 77 |ELEASE..host: ww|
|00000040| 77 2e 79 61 68 6f 6f 2e 63 6f 2e 6a 70 0d 0a 61 |w.yahoo.co.jp..a|
|00000050| 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 63 6f 6e 74 |ccept: */*..cont|
|00000060| 65 6e 74 2d 6c 65 6e 67 74 68 3a 20 30 0d 0a 0d |ent-length: 0...|
|00000070| 0a |. |
+--------+-------------------------------------------------+----------------+
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
10
11. Reactor Netty 0.8 Update
• Spring Boot 2.1対応
• HTTP/2対応
• Server/Clientの新Builder API
• パッケージ名/Maven Group ID変更
• 内部実装の進化
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
11
12. Reactor Netty 0.8の注意
• パッケージ名/Maven Group ID変更
パッケージ名
reactor.ipc.netty → reactor.netty
Group ID
io.projectreactor.ipc.netty → io.projectreactor.netty
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
12
13. Reactor Netty 0.8の注意(ハマりました。。)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
13
My App
Srping Boot
/ WebFlux
2.1
cloudfoundry-
client-reactor
3.13.0
Reactor Netty
(io.projectreact
or.netty)
0.8
Reactor Netty
(io.projectreact
or.ipc.netty)
0.7
• Reactor-Nettyをバックエンドとするライブラリを使う際は注
意
???
14. Walking up the Spring for Apache
Kafka Stack
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
14
18. Kafka Connectors
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
18
引用: https://www.slideshare.net/SpringCentral/walking-up-the-spring-for-apache-kafka-stack
19. Kafka Streams
• Kafkaを用いたストリーミング処理を書くためのライブラリ
• メッセージストリームをKStream/KTableという概念に抽象化し
てプログラミング
• Stream/Tableという名前から連想できるようにmap/join等の
処理を簡単に書ける
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
19
20. Kafka Streams
• Kafkaを用いたストリーミング処理を書くためのライブラリ
• メッセージストリームをKStream/KTableという概念に抽象化し
てプログラミング
• Stream/Tableという名前から連想できるようにmap/join等の
処理を簡単に書ける
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
20
22. Spring for Apache Kafka
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
22
• ここまではpure Kafkaな話
• Springでは様々なレイヤーからKafka利用をサポート
23. Kafka Streams & Spring Boot
• Spring BootでKafka Streamsを簡単に設定
spring:
kafka:
bootstrap-servers:
- localhost:9092
streams:
application-id: stream-app
properties:
commit.interval.ms: 1000
...
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
23
24. Spring for Apache Kafka
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
24
引用: https://www.slideshare.net/SpringCentral/walking-up-the-spring-for-apache-kafka-stack
25. Spring for Apache Kafka
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved.
25
• Spring For Apache Kafka
• KafkaTemplate
• @KafkaListener
• Spring Integration (Kafka Extension)
• メッセージ通信の抽象化(Message Channel, Endpoint)
• Kakfa非依存化
• Spring Cloud Streams
• Opinionated Configuration
• Kafka Streamsサポート
• Reactor Kafka
• KafkaSender.send(Publisher<... SenderRecord>)
• KafkaReceiver.receive(): Flux<ReceiverRecord<...>>