我有一个 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
订阅者接收。
任何想法为什么?