Moving from Server to Service
Now, we’re ready to implement the Server layer and lay the foundation for a service DSL. This will largely follow the pattern of the server we implemented in Chapter 6, Doing I/O Right, with Event Loops, but will be more oriented toward supporting typed messages and responses rather than free-form strings. However, we’ll try to isolate the server from some of the subtleties of the actual DSL to control the complexity and allow for alternative designs.
Basic Definitions
First, the core data structures we need to define are the Request and Response types—the core accommodation we need to make is to parameterize both over some Scala type T. By design, the actual server will only receive Request[String] and Response[String] ...
Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.