1
votes

I have an Akka ActorEventBus (reference https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala#L70) that handles a lot of messages being passed around to different actors.

I've set up an Actor to subscribe to this Bus:

/**
   * special actor that transports messages to the hive
   */
  val hiveTalk = {
    val subscriber = actorSystem.actorOf(Props(new HiveTransport))

    Bus.subscribe( subscriber, "/app/browser/" )
    Bus.subscribe( subscriber, "/app/mobile/" )
  }

The MessageBus class which is an implementation of the ActorEventBus looks like the following:

/**
 * message bus to route messages to their appropriate contexts
 */
class MessageBus extends ActorEventBus with LookupClassification {

    type Event = MessageEvent
  type Classifier = String

  protected def mapSize(): Int = {
    10
  }

  protected def classify(event: Event): Classifier = {
    event.channel
  }

  protected def publish(event: Event, subscriber: Subscriber): Unit = {
    subscriber ! event
  }

}

The Problem

For some reason, messages sent to sub-channels that look like /app/browser/26 aren't being received by the hiveTalk actor-subscriber.

Any ideas why?

1

1 Answers

2
votes

Solved. Apparently Lookup Classification is actually only meant to be a simple, single-channel implementation.

Subchannel Classification is the Akka trait meant to actually implement sub channels.

http://doc.akka.io/docs/akka/2.0/scala/event-bus.html#Subchannel_Classification