Andreas Eisele
Andreas Eisele

Reputation: 743

Scala message bus implementation by Actors?

I want to implement some kind of message bus in one of my Scala applications. The features would be:

What I plan to do is to implement all nodes and the bus itself as standard Scala actors. For example I want to define a trait Subscriber like this:

trait Subscriber[M <: Message[_]] {
  this: Actor =>
  def notify(message: M)
}

Ideally mixing in this trait should already register the subscription for the type M.

So does this idea make sense? Are there better approaches to realize a message bus?

Upvotes: 4

Views: 603

Answers (1)

Viktor Klang
Viktor Klang

Reputation: 26579

Disclaimer: I am the PO of Akka

Hi Itti,

This has already been done for you in Akka, the Actor Kernel: www.akka.io

Docs: http://doc.akkasource.org/routing-scala

Pub/Sub: Akka Listeners Routers: Akka Routers Convenience: Akka Routing

Upvotes: 5

Related Questions