JuliaActors: a road to an Actors ecosystem

Good news: Actors.jl has been rewritten and is available as v0.1.1 from the Julia registry. It provides

  • the basic functionality of the classical Actor Model and
  • a minimal interface which allows other actor libraries to plugin the Actors API and their actors to communicate with each other.

This proposal of @tisztamo turned out to work very well. In order to demonstrate how that works, I wrote a completely different toy actor library SlowActors.jl with about 100 lines of code. It uses the Actors API, can run the same examples as Actors and actors from both libraries can communicate with each other:

julia> using SlowActors

julia> raise(a, b) = a^b
raise (generic function with 1 method)

julia> query(act, a, b) = request!(act, a, b)
query (generic function with 1 method)

julia> A = Actors.spawn(Func(raise))
Link{Channel{Any}}(Channel{Any}(sz_max:32,sz_curr:0), 1, :local)

julia> B = spawn(Func(query, A))
Link{SlowActors.Mailbox}(SlowActors.Mailbox(Deque [Any[]], ...

julia> request!(B, 2, 2)
4

In that example “slow” actor B queries actor A to raise 2 by 2, takes back the result and delivers it. This works in either direction.

That means that we can start to connect our actor libraries around the Actors interface. How that works is described on the integration page of SlowActors.

Now we can progress to step 2 above to provide Actors with a modern API, a registry, a supervision tree …

6 Likes