akka-stream-netty


License

License

Categories

Categories

Net Netty Networking Akka Container Microservices Reactive libraries
GroupId

GroupId

com.github.zhongl
ArtifactId

ArtifactId

akka-stream-netty_2.12
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

akka-stream-netty
akka-stream-netty
Project URL

Project URL

https://github.com/zhongl/akka-stream-netty
Project Organization

Project Organization

com.github.zhongl
Source Code Management

Source Code Management

https://github.com/zhongl/akka-stream-netty

Download akka-stream-netty_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.zhongl/akka-stream-netty_2.12/ -->
<dependency>
    <groupId>com.github.zhongl</groupId>
    <artifactId>akka-stream-netty_2.12</artifactId>
    <version>0.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.zhongl/akka-stream-netty_2.12/
implementation 'com.github.zhongl:akka-stream-netty_2.12:0.1.2'
// https://jarcasting.com/artifacts/com.github.zhongl/akka-stream-netty_2.12/
implementation ("com.github.zhongl:akka-stream-netty_2.12:0.1.2")
'com.github.zhongl:akka-stream-netty_2.12:jar:0.1.2'
<dependency org="com.github.zhongl" name="akka-stream-netty_2.12" rev="0.1.2">
  <artifact name="akka-stream-netty_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.zhongl', module='akka-stream-netty_2.12', version='0.1.2')
)
libraryDependencies += "com.github.zhongl" % "akka-stream-netty_2.12" % "0.1.2"
[com.github.zhongl/akka-stream-netty_2.12 "0.1.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.12
org.scoverage : scalac-scoverage-runtime_2.12 jar 1.4.1

Project Modules

There are no modules declared in this project.

CI Release Coveralls github Codacy Badge Maven Central

akka-stream-netty is a scala lib to adapt netty transport to akka-stream, which let us can use native transport with:

  • epoll
  • kqueue
  • unix domain socket

alpakka-unix-domain-socket would be a alternative if you only want to use unix domain socket.

Dependencies

libraryDependencies += "com.github.zhongl" %% "akka-stream-netty-all" % <latest tag>

Usage

import java.net._
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl._
import akka.util.ByteString
import io.netty.channel.socket._
import zhongl.stream.netty._
import all._

implicit val system = ActorSystem("demo")
implicit val mat = ActorMaterializer()
implicit val ec = system.dispatcher

Netty().bindAndHandle[ServerSocketChannel](Flow[ByteString].map(identity), new InetSocketAddress("localhost", 8080)).flatMap { sb =>
  Source.repeat(ByteString("a"))
    .delay(1.seconds) 
    .via(Netty().outgoingConnection[SocketChannel](sb.localAddress))
    .runForeach(println)
    .flatMap(_ => sb.unbind())    
}

More usage information please see test cases.

Versions

Version
0.1.2