Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Play and Reactive Streams #play_ja

Play and Reactive Streams #play_ja

In Play meetup 2 (2015/07/05) by @okapies
https://playframeworkja.doorkeeper.jp/events/27023

※ Reactive Streams 入門 (https://speakerdeck.com/okapies/reactive-streams-ru-men-number-jjug) の補足スライドです。

Yuta Okamoto

July 05, 2015
Tweet

More Decks by Yuta Okamoto

Other Decks in Programming

Transcript

  1. ஫ҙॻ͖ • ຊεϥΠυ͸ɺ6/24 ͷ JJUG Night Seminar Ͱൃදͨ͠ ”Reactive Streams

    ೖ໳” ͷิ଍ࢿ ྉͰ͢ɻ • ݩࢿྉ΁ͷϦϯΫ͸ˣͷઆ໌ཝʹॻ͍ͯ͋Δ ͷͰɺ͝ڵຯͷ͋Δํ͸ͥͻ͝ࢀর͍ͩ͘͞ɻ
  2. ࣍ʹى͖Δ͜ͱ (2.5 Ҏ߱) 1. Netty backend → Akka HTTP backend

    2. Iteratee → Accumulator with Akka Streams
  3. Accumulator final class Accumulator[-E, +A](sink: Sink[E, Future[A]]) { def map[B](f:

    A => B) (implicit executor: ExecutionContext): Accumulator[E, B] def recoverWith[B >: A](pf: PartialFunction[Throwable, Future[B]]) (implicit executor: ExecutionContext): Accumulator[E, B] ! def run(source: Source[E, _]) (implicit materializer: Materializer): Future[A] =
 source.toMat(sink)(Keep.right).run() } E ܕͷετϦʔϜ (ෳ਺஋) Λ
 Future[A] (୯Ұ஋) ʹ۩ݱԽ͢Δ • Akka Streams (ͷ Sink) ͷബ͍ϥούʔ • ཁૉΛྦྷੵ (accumulate) ݁͠ՌΛ Future ʹม׵ play-streams: play.api.libs.streams.Accumulator
  4. ࢀߟࢿྉ • “Play 3 Implementation Plan” https://docs.google.com/document/ d/1OejviUX5TDlRVeKg1JD9L4qh2Tn21giItmyxRXCydN0/ edit#heading=h.l3a9tmzfgjwy •

    “Play 2.4͕ґଘੑ஫ೖΛ࠾༻ɼJava 8ʹҠߦ" http:// www.infoq.com/jp/news/2015/06/play-24-dependency-injection • “Reactive Streams and Play 3.0” http://jroper.github.io/play3- streams/ • “Play, Akka streams, and reactive streams” https:// groups.google.com/forum/#!topic/play-framework-dev/ tiHAe23PryQ