时至今日，我们从因特尔上消遣服务包含许多流媒体数据(streaming data)，包括下载、上传、点对点的数据传送。把数据整体看做是一个元素集合的流(a stream of elements)，对我们计算机发送和接收这些数据起了很大帮助，因为数据变得越来越庞大，以“流”的方式处理数据显得很有必要。
Akka Streams have these key properties:
- They implement the Reactive Streams specification, whose three main goals backpressure, async and non-blocking boundaries and interoperability between different implementations do fully apply for Akka Streams too.
- They provide an abstraction for an evaluation engine for the streams, which is called
- Programs are formulated as reusable building blocks, which are represented as the three main types
Flow. The building blocks form a graph whose evaluation is based on the
Materializerand needs to be explicitly triggered.
In the following a deeper introduction in how to use the three main types shall be given.
Scala 这个语言可以用得很复杂、也可以用得很简洁。它在 Java 并发和 OO 之上做了进一步的抽象，将代码量大大降低。
最近流行的很多项目都使用 Scala，比如 Akka，Spark，Kafka，Spray，Play Framework，足见它是一门生产力很高的语言。
Spray is a well-known HTTP library in the Scala ecosystem. It was released in 2011, and since then it’s been widely used by the Scala community. It was recently announced that Spray would be replaced with Akka HTTP, thus cementing Akka HTTP as the successor of Spray. It’s maintained by Lightbend and it’s been recommended that users migrate to it soon.
However, migration from one major version of a library to another is not an easy task. Very often it requires you to spend some time reading the source code in order to figure out how to use certain features, as well as how to migrate existing logic.
This post will demonstrate what changes should be applied in order to migrate your app from Spray to Akka HTTP. The following steps don’t have a particular order, as it depends on which areas need to be rewritten.