我尝试以下操作:
class ClientActor (stockActor: ActorSelection, paymentsActor: ActorSelection) extends PersistentActor
with AtLeastOnceDelivery with akka.actor.ActorLogging with RequiresMessageQueue[akka.custom.CustomMailbox]{
//actor implementation
}
我得到了错误:
illegal inheritance;
self-type Shopping.ClientActor does not conform to akka.dispatch.RequiresMessageQueue[akka.custom.CustomMailbox]'s selftype akka.dispatch.RequiresMessageQueue[akka.custom.CustomMailbox]
with AtLeastOnceDelivery with akka.actor.ActorLogging with RequiresMessageQueue[akka.custom.CustomMailbox]{
对于非持久性参与者也是如此:
class PaymentsActor extends Actor with akka.actor.ActorLogging with RequiresMessageQueue[akka.custom.CustomMailbox] {
// actor implementation
}
答案 0 :(得分:1)
跟踪相关的源代码,PersistentActor
扩展了Eventsourced
,扩展了PersistenceStash,又扩展了trait Stash:
trait Stash extends UnrestrictedStash with RequiresMessageQueue[DequeBasedMessageQueueSemantics]
如源代码中所述:
请注意,
Stash
特征只能与具有以下特征的演员一起使用: 有一个基于双端队列的邮箱。默认情况下,基于存储的演员请求 由于存储特性增加了基于双端队列的邮箱RequiresMessageQueue[DequeBasedMessageQueueSemantics]
。 您可以覆盖以下情况下提供的默认邮箱:DequeBasedMessageQueueSemantics
是通过配置请求的 ...
一种方法是配置您的自定义邮箱,类似于源代码注释中所建议的:
akka.actor.mailbox.requirements {
"akka.dispatch.BoundedDequeBasedMessageQueueSemantics" = your-custom-mailbox
}