What is AsyncScala?

AsyncScala projects provide Scala implementation of asynchronous control constructs from E programming language and some additional control constructs inspired by Occam.

The AsyncScala framework simplifies writing asynchronous event-driven dataflow-based applications in Scala. It mainly builds upon ideas and syntax of E programming language. However, it also draws ideas from other programming languages like Occam and frameworks like SEDA as well. In addition to core library that supports common asynchronous communication patterns. The framework provides a wrapper for NIO-based sockets that simplify creation of network applications that support a high number of concurrent connections.

The framework automates the following common tasks for event loop programming:

Designating destination for events within event loop
The destination of events is a object or closure. This object has a proxy that dispatches events to its event loop. The proxy can be passed around.
Posting events to event loop in strongly typed way
It is as simple as invoking a method on the proxy of the objects or using utility method.
Creating modular asynchronous components
The components are normal objects that extend specific base class and implement their asynchronous interfaces.Normal OO application development techniques can be used. The proxy for such objects is created by the framework.
Combining components into the single asynchronous application
The components do not need to directly create threads and to be aware about them. This remove major source of integration problems for asynchronous components. The event loop (vat) itself is managed by framework. And this event loop might support multiple components at the same time. No special efforts are required from the application developer to achieve this.
Returning results from asynchronous operations
The request-response asynchronous operations return promise that resolves when operation is finished. The application might continue execution when promise is resolved. The aWhen operator simplifies listening on promise.
Composing asynchronous operations from simpler ones
The framework provides utility classes that simplify composing asynchronous operations: aSeq, aAll, aAny, aAny. It makes a event-driven programming structured!


The framework is going to change and it is currently of alpha-quality. So there should be no expectation of binary or source compatibility between different versions (I have changed framework a lot when I was preparing this release). Use it on own risk. The asynchronous control flow DSL defined in AsyncControl object will likely stay the same, unless some more usable notation is discovered.

Other Languages

There are also projects AsyncObjects for Java and AsyncGroovy that implement the same ideas. These projects was predecessors to this project. However, when working on this project, I have realized how these projects could be improved as well (thanks to picky Scala type systems forces to rethink some hacks into more straightforward and logical solution). So consider their state as somewhat obsolete. That two projects will be likely merged into one and maybe some code will be shared with Scala version as well.