Skip to content

Commit

Permalink
finished pubsub example
Browse files Browse the repository at this point in the history
vheaffinitech committed Apr 15, 2016
1 parent 43c2c5b commit 094f9bf
Showing 558 changed files with 16,679 additions and 129 deletions.
12 changes: 12 additions & 0 deletions step15-streams/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name := "Hello Test #1"

version := "1.0"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.4",
"com.typesafe.akka" %% "akka-stream" % "2.4.4"
)

fork in run := true
27 changes: 27 additions & 0 deletions step15-streams/main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Flow, Sink, Source}

import scala.collection.immutable
import scala.util.Random

object Stream extends App {
implicit val actorSystem = ActorSystem()
import actorSystem.dispatcher
implicit val flowMaterializer = ActorMaterializer()

// Source
val input = Source(1 to 100)

// Flow
val normalize = Flow[Int].map(_ * 2)

// Sink
val output = Sink.foreach[Int](println)

input.via(normalize).runWith(output).andThen {
case _ =>
actorSystem.shutdown()
actorSystem.awaitTermination()
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#hello-test-1#hello-test-1_2.11;1.0 resolved revisions
#Fri Apr 15 08:19:14 CEST 2016
+organisation\:\#@\#\:+org.scala-lang\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+scala-library\:\#@\#\:+revision\:\#@\#\:+2.11.7\:\#@\#\:=2.11.7 ? 2.11.7 null
+organisation\:\#@\#\:+com.typesafe.akka\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+akka-stream_2.11\:\#@\#\:+revision\:\#@\#\:+2.4.4\:\#@\#\:=2.4.4 release 2.4.4 null
+organisation\:\#@\#\:+org.scala-lang\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+scala-compiler\:\#@\#\:+revision\:\#@\#\:+2.11.7\:\#@\#\:=2.11.7 release 2.11.7 null
+organisation\:\#@\#\:+com.typesafe.akka\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+akka-actor_2.11\:\#@\#\:+revision\:\#@\#\:+2.4.4\:\#@\#\:=2.4.4 release 2.4.4 null
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
status="integration"
publication="20160415081911"
>
<description>
Hello Test #1
</description>
</info>
<configurations>
<conf name="compile" visibility="public" description=""/>
<conf name="runtime" visibility="public" description="" extends="compile"/>
<conf name="test" visibility="public" description="" extends="runtime"/>
<conf name="provided" visibility="public" description=""/>
<conf name="optional" visibility="public" description=""/>
<conf name="compile-internal" visibility="private" description="" extends="compile,optional,provided"/>
<conf name="runtime-internal" visibility="private" description="" extends="runtime,optional"/>
<conf name="test-internal" visibility="private" description="" extends="test,optional,provided"/>
<conf name="plugin" visibility="private" description=""/>
<conf name="sources" visibility="public" description=""/>
<conf name="docs" visibility="public" description=""/>
<conf name="pom" visibility="public" description=""/>
<conf name="scala-tool" visibility="private" description=""/>
</configurations>
<publications>
<artifact name="hello-test-1_2.11" type="pom" ext="pom" conf="pom"/>
<artifact name="hello-test-1_2.11" type="jar" ext="jar" conf="compile"/>
<artifact name="hello-test-1_2.11" type="src" ext="jar" conf="sources" e:classifier="sources"/>
<artifact name="hello-test-1_2.11" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
</publications>
<dependencies>
<dependency org="org.scala-lang" name="scala-compiler" rev="2.11.7" conf="scala-tool->default,optional(default)"/>
<dependency org="org.scala-lang" name="scala-library" rev="2.11.7" conf="scala-tool->default,optional(default);compile->default(compile)"/>
<dependency org="com.typesafe.akka" name="akka-actor_2.11" rev="2.4.4" conf="compile->default(compile)"/>
<dependency org="com.typesafe.akka" name="akka-stream_2.11" rev="2.4.4" conf="compile->default(compile)"/>
</dependencies>
</ivy-module>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
conf="docs"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160415081911"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
conf="optional"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160415081911"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
conf="plugin"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160415081911"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
conf="pom"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160415081911"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="hello-test-1"
module="hello-test-1_2.11"
revision="1.0"
conf="provided"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160415081911"/>
<dependencies>
</dependencies>
</ivy-report>
Loading

0 comments on commit 094f9bf

Please sign in to comment.