为什么Akka Actor没有收到子频道?

时间:2012-09-24 22:40:46

标签: scala akka

我有一个Akka ActorEventBus(引用https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala#L70),可以处理大量传递给不同演员的消息。

我已经设置了一个Actor来订阅这个总线:

/**
   * 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/" )
  }

作为MessageBus的实现的ActorEventBus类如下所示:

/**
 * 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
  }

}

问题

出于某种原因,/app/browser/26演员订阅者未收到发送到hiveTalk子频道的消息。

任何想法为什么?

1 个答案:

答案 0 :(得分:2)

解决。显然Lookup Classification实际上只是一个简单的单通道实现。

Subchannel Classification是实际实现子频道的Akka特征。

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