Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanabix/akka-stream-netty
Adapt netty transport to akka-stream
https://github.com/hanabix/akka-stream-netty
akka akka-stream epoll kqueue netty unix-domain-socket
Last synced: 22 days ago
JSON representation
Adapt netty transport to akka-stream
- Host: GitHub
- URL: https://github.com/hanabix/akka-stream-netty
- Owner: hanabix
- License: apache-2.0
- Created: 2019-03-05T11:57:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T14:11:45.000Z (about 2 months ago)
- Last Synced: 2024-10-01T08:01:20.720Z (about 1 month ago)
- Topics: akka, akka-stream, epoll, kqueue, netty, unix-domain-socket
- Language: Scala
- Homepage:
- Size: 157 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![CI](https://github.com/hanabix/akka-stream-netty/actions/workflows/ci.yml/badge.svg)](https://github.com/hanabix/akka-stream-netty/actions/workflows/ci.yml) [![Publish](https://github.com/hanabix/akka-stream-netty/actions/workflows/sbt-release.yml/badge.svg)](https://github.com/hanabix/akka-stream-netty/actions/workflows/sbt-release.yml)[![Coveralls github](https://img.shields.io/coveralls/github/hanabix/akka-stream-netty.svg)](https://coveralls.io/github/hanabix/akka-stream-netty?branch=master) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/9319321446b0455bb585530da133ff5d)](https://www.codacy.com/gh/hanabix/akka-stream-netty/dashboard?utm_source=github.com&utm_medium=referral&utm_content=hanabix/akka-stream-netty&utm_campaign=Badge_Grade) [![Maven Central](https://img.shields.io/maven-central/v/com.github.zhongl/akka-stream-netty-all_2.13)](https://search.maven.org/artifact/com.github.zhongl/akka-stream-netty-all_2.13)
**akka-stream-netty** is a scala lib to adapt [netty](https://netty.io) transport to [akka-stream](https://doc.akka.io/docs/akka/current/stream/index.html), which let us can use native transport with:
- epoll
- kqueue
- unix domain socket> [alpakka-unix-domain-socket](https://github.com/akka/alpakka) would be a alternative if you only want to use unix domain socket.
# Dependencies
```scala
libraryDependencies += "com.github.zhongl" %% "akka-stream-netty-all" %
```# Usage
```scala
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.dispatcherNetty().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](./all/src/test/scala/zhongl/stream/netty/all).