user972946
user972946

Reputation:

How to migrate Input/OutputChannel from Scala Actors to Akka?

According to this guide:

http://docs.scala-lang.org/overviews/core/actors-migration-guide.html

scala.actors._ -> akka.actor._

However there does not seeem to be InputChannel/OutputChannel/Channel.

So to migrate from Scala Actors to Akka Actors, where can I find those Channel APIs?

Upvotes: 1

Views: 148

Answers (2)

Arseniy Zhizhelev
Arseniy Zhizhelev

Reputation: 2401

There is a SynapseGrid library that can be a replacement for typed channels between actors.

One can create a so called "Contact" that can be shared between actors.

In one actor (Subsystem) one passes data to the contact:

val someInput = contact[String]("someInput")
val SharedContact = contact[String]("SharedContact")
outputs(SharedContact)
someInput.map("Hello, "+_)>>SharedContact

In another actor it appears on the same contact ready for consumption:

inputs(SharedContact)
SharedContact.map(_+"!").foreach(s => println("Got from other actor: "+s))

Everything is strictly typed.

However, SynapseGrid is more suitable for large systems.

Upvotes: 0

cmbaxter
cmbaxter

Reputation: 35443

I think what you might want is contained in the latest version of Akka and is called Typed Channels. It's marked as experimental because its a new feature and will probably be in flux for a bit but I believe it's similar to what you are looking for.

http://doc.akka.io/docs/akka/2.2.0/scala/typed-channels.html

Upvotes: 1

Related Questions