Akka Documentation Release 2.0

Akka Documentation Release 2.0

Akka Documentation Release 2.0 Typesafe Inc March 08, 2012 CONTENTS 1 Introduction 1 1.1 What is Akka?............................................1 1.2 Why Akka?..............................................3 1.3 Getting Started............................................3 1.4 Getting Started Tutorial (Scala): First Chapter...........................6 1.5 Getting Started Tutorial (Java): First Chapter............................ 16 1.6 Use-case and Deployment Scenarios................................. 29 1.7 Examples of use-cases for Akka................................... 30 2 General 32 2.1 Actor Systems............................................ 32 2.2 What is an Actor?.......................................... 33 2.3 Supervision and Monitoring..................................... 35 2.4 Actor References, Paths and Addresses............................... 37 2.5 Location Transparency........................................ 43 2.6 Akka and the Java Memory Model.................................. 44 2.7 Message send semantics....................................... 46 2.8 Configuration............................................. 47 3 Common utilities 63 3.1 Duration............................................... 63 4 Scala API 65 4.1 Actors (Scala)............................................ 65 4.2 Typed Actors (Scala)......................................... 76 4.3 Logging (Scala)........................................... 81 4.4 Event Bus (Scala).......................................... 85 4.5 Scheduler (Scala)........................................... 88 4.6 Futures (Scala)............................................ 90 4.7 Dataflow Concurrency (Scala).................................... 96 4.8 Fault Tolerance (Scala)........................................ 100 4.9 Dispatchers (Scala).......................................... 114 4.10 Routing (Scala)............................................ 118 4.11 Remoting (Scala)........................................... 126 4.12 Serialization (Scala)......................................... 134 4.13 FSM................................................. 137 4.14 Software Transactional Memory (Scala)............................... 145 4.15 Agents (Scala)............................................ 146 4.16 Transactors (Scala).......................................... 148 4.17 IO (Scala)............................................... 152 4.18 Testing Actor Systems (Scala).................................... 157 4.19 Akka Extensions (Scala)....................................... 170 4.20 ZeroMQ (Scala)........................................... 172 i 5 Java API 177 5.1 Actors (Java)............................................. 177 5.2 Typed Actors (Java)......................................... 188 5.3 Logging (Java)............................................ 193 5.4 Event Bus (Java)........................................... 197 5.5 Scheduler (Java)........................................... 199 5.6 Futures (Java)............................................. 202 5.7 Fault Tolerance (Java)........................................ 209 5.8 Dispatchers (Java).......................................... 228 5.9 Routing (Java)............................................ 232 5.10 Remoting (Java)........................................... 241 5.11 Serialization (Java).......................................... 251 5.12 Software Transactional Memory (Java)............................... 254 5.13 Agents (Java)............................................. 255 5.14 Transactors (Java).......................................... 256 5.15 Building Finite State Machine Actors (Java)............................. 260 5.16 Akka Extensions (Java)....................................... 263 5.17 ZeroMQ (Java)............................................ 265 6 Cluster 271 6.1 Cluster Specification......................................... 271 7 Modules 280 7.1 Durable Mailboxes.......................................... 280 7.2 HTTP................................................. 286 7.3 Microkernel............................................. 286 7.4 Camel................................................. 288 7.5 Spring Integration.......................................... 288 8 Information for Developers 289 8.1 Building Akka............................................ 289 8.2 Multi-JVM Testing.......................................... 290 8.3 Developer Guidelines........................................ 296 8.4 Documentation Guidelines...................................... 297 8.5 Team................................................. 299 9 Project Information 300 9.1 Migration Guides........................................... 300 9.2 Release Notes............................................ 312 9.3 Scaladoc API............................................. 315 9.4 Documentation for Other Versions.................................. 316 9.5 Issue Tracking............................................ 316 9.6 Licenses............................................... 317 9.7 Sponsors............................................... 320 9.8 Commercial Support......................................... 320 9.9 Mailing List............................................. 320 9.10 Downloads.............................................. 320 9.11 Source Code............................................. 320 9.12 Releases Repository......................................... 320 9.13 Snapshots Repository........................................ 321 10 Additional Information 322 10.1 Here is a list of recipes for all things Akka............................. 322 10.2 Companies and Open Source projects using Akka.......................... 322 10.3 Third-party Integrations....................................... 326 10.4 Other Language Bindings...................................... 327 11 Links 328 ii CHAPTER ONE INTRODUCTION 1.1 What is Akka? Scalable real-time transaction processing We believe that writing correct concurrent, fault-tolerant and scalable applications is too hard. Most of the time it’s because we are using the wrong tools and the wrong level of abstraction. Akka is here to change that. Using the Actor Model we raise the abstraction level and provide a better platform to build correct concurrent and scalable applications. For fault-tolerance we adopt the “Let it crash” model which have been used with great success in the telecom industry to build applications that self-heals, systems that never stop. Actors also provides the abstraction for transparent distribution and the basis for truly scalable and fault-tolerant applications. Akka is Open Source and available under the Apache 2 License. Download from http://akka.io/downloads/ 1.1.1 Akka implements a unique hybrid Actors Actors give you: • Simple and high-level abstractions for concurrency and parallelism. • Asynchronous, non-blocking and highly performant event-driven programming model. • Very lightweight event-driven processes (approximately 2.7 million actors per GB RAM). See Actors (Scala) and Actors (Java) Fault Tolerance Fault tolerance through supervisor hierarchies with “let-it-crash” semantics. Excellent for writing highly fault- tolerant systems that never stop, systems that self-heal. Supervisor hierarchies can span over multiple JVMs to provide truly fault-tolerant systems. See Fault Tolerance (Scala) and Fault Tolerance (Java) Location Transparency Everything in Akka is designed to work in a distributed environment: all interactions of actors use purely message passing and everything is asynchronous. For an overview of the remoting see Location Transparency 1 Akka Documentation, Release 2.0 Transactors Transactors combine actors and STM (Software Transactional Memory) into transactional actors. It allows you to compose atomic message flows with automatic retry and rollback. See Transactors (Scala) and Transactors (Java) 1.1.2 Scala and Java APIs Akka has both a Scala API and a Java API. 1.1.3 Akka can be used in two different ways • As a library: used by a web app, to be put into WEB-INF/lib or as a regular JAR on your classpath. • As a microkernel: stand-alone kernel to drop your application into. See the Use-case and Deployment Scenarios for details. 1.1.4 What happened to Cloudy Akka? The commercial offering was earlier referred to as Cloudy Akka. This offering consisted of two things: • Cluster support for Akka • Monitoring & Management (formerly called Atmos) Cloudy Akka have been discontinued and the Cluster support is now being moved into the Open Source version of Akka (the upcoming Akka 2.1), while the Monitoring & Management (Atmos) is now rebranded into Typesafe Console and is part of the commercial subscription for the Typesafe Stack (see below for details). 1.1.5 Typesafe Stack Akka is now also part of the Typesafe Stack. The Typesafe Stack is a modern software platform that makes it easy for developers to build scalable software applications. It combines the Scala programming language, Akka, the Play! web framework and robust developer tools in a simple package that integrates seamlessly with existing Java infrastructure. The Typesafe Stack is all fully open source. 1.1.6 Typesafe Console On top of the Typesafe Stack we have also have commercial product called Typesafe Console which provides the following features: 1. Slick Web UI with real-time view into the system 2. Management through Dashboard, JMX and REST 3. Dapper-style tracing of messages across components and remote nodes 4. Real-time statistics 5. Very low overhead monitoring agents (should

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    331 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us