Akka(1)Introduction

lrxcmwy 2013-01-11

Akka(1)Introduction

1.Introduction

1.1WhatisAkka?

Designtowritecorrectconcurrent,fault-tolerantandscalableapplications.

Akkaimplementsauniquehybrid

Actors

Simpleandhigh-levelabstractionsforconcurrencyandparallelism.

Asynchronous,non-blockingandhighlyperformantevent-drivenprogrammingmodel.

lightweightevent-drivenprocesses,2.7millionactorsperGBRAM

Scaladocuments:http://doc.akka.io/docs/akka/2.1.0/scala/actors.html#actors-scala

FaultTolerance

FaulthandlinginPracticeforscala

http://doc.akka.io/docs/akka/2.1.0/scala/fault-tolerance.html#fault-tolerance-scala

LocationTransparency

Allinteractionsofactorsusepuremessagepassingandeverythingisasynchronous.

http://doc.akka.io/docs/akka/2.1.0/general/remoting.html#remoting

Transactors

transactorscombineactorsandSoftwareTransactionalMemory(STM)intotransactionalactors.

http://doc.akka.io/docs/akka/2.1.0/scala/transactors.html#transactors-scala

ScalaAPIs

http://doc.akka.io/docs/akka/2.1.0/scala/index.html#scala-api

Akkacanbeusedin2differentways

AsalibraryinWEB-INF/lib

Asamicrokernel,stand-alonekernel

http://doc.akka.io/docs/akka/2.1.0/scala/microkernel.html#microkernel-scala

1.2.WhyAkka?

…snip...

1.3GettingStarted

GettingStartedGuidesandTemplateProjects

InstallTypesafeStack

Followthedocumenthere:http://typesafe.com/stack/download-agreed

Installscala,set,mavenandgiter8.ButIalreadyhaveallofthemexceptgiter8.

>sudoportinstallgiter8

Anddownloadthefilefromherehttp://downloads.typesafe.com/typesafe-stack/2.0.2/typesafe-stack-2.0.2.tgz

Unzipandplaceinworkingdirectory.

Ialreadyhaveallthetools,soIdonotneedtypesafestackbin,Ijustwillgothroughtheexample.

Visitthispage,youcanfindalltheexamples:

https://github.com/typesafehub

Modules

akka-actorClassicActors,TypedActors,IOActoretc.

akka-remoteRemoteActors

akka-testkit

akka-kernelAkkamicrokernelforrunningabare-bonesminiapplicationserver

akka-transactorTransactionalactors

akka-agent

akka-camel

akka-zeromqZeroMQintegration

akka-slf4j

akka-filebased-mailbox

Usingareleasedistribution

Downloadthefilefromhere:http://typesafe.com/stack/downloads/akka

Usingwithsbt

"typesaferepo"at"http://repo.typesafe.com/typesafe/releases/",

"com.typesafe.akka"%%"akka-actor"%"2.1.0",

"com.typesafe.akka"%%"akka-testkit"%"2.1.0",

"com.typesafe.akka"%%"akka-transactor"%"2.1.0",

HowcanIuseanddeployAkka

…snip…

References:

http://akka.io/

http://doc.akka.io/docs/akka/2.1.0/

http://typesafe.com/resources/tutorials/getting-started-with-akka-scala.html#getting-started-with-akka-scala

https://github.com/typesafehub

相关推荐