Testkit and custom Mailbox type

73 views
Skip to first unread message

nil...@gmail.com

unread,
Jan 29, 2014, 2:33:50 AM1/29/14
to akka...@googlegroups.com
I'm trying to implement a custom mailbox according to the guidelines at http://doc.akka.io/docs/akka/snapshot/java/mailboxes.html for our akka application (akka 2.2.3), creating a marker "Semantics" interface, and having my actor implementing the RequiresMessageQueue<MyQueueSemantics>. This works perfectly fine, except when running our unit tests, which are using Akka Testkit, in which case it produces an exception. The error we are getting is:

java.lang.NullPointerException
at akka.actor.dungeon.Dispatch$class.init(Dispatch.scala:62)
at akka.actor.ActorCell.init(ActorCell.scala:338)
at akka.actor.LocalActorRef.<init>(ActorRef.scala:304)
at akka.testkit.TestActorRef.<init>(TestActorRef.scala:21)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:141)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:137)
at akka.testkit.TestActorRef$.create(TestActorRef.scala:160)
at akka.testkit.TestActorRef.create(TestActorRef.scala)


s"Actor [$self] requires mailbox type [$req] got [${mbox.messageQueue.getClass.getName}]")))

I assume it means that mbox.messageQueue is found to be null. As mentioned, the code runs fine, except when using the testing framework. Is there anything in particular that need to be done to use a custom mailbox implementation this way in our tests? If we configure the mailbox in our application.conf instead, for our dispatcher, everything works fine, both normally and with our tests.

Nils-H

nil...@gmail.com

unread,
Jan 29, 2014, 4:24:23 AM1/29/14
to akka...@googlegroups.com
It does seem to work with akka 2.3-RC1, however.

Nils-H

Patrik Nordwall

unread,
Jan 29, 2014, 8:13:10 AM1/29/14
to akka...@googlegroups.com
Hi Nils-H,

As you have figured out this has been fixed in 2.3.0-RC1, and I'm afraid there is no workaround for 2.2.3. I hope you are able to switch to 2.3.0-RC1.

/Patrik


On Wed, Jan 29, 2014 at 10:24 AM, <nil...@gmail.com> wrote:
It does seem to work with akka 2.3-RC1, however.

Nils-H

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--

Patrik Nordwall
Typesafe Reactive apps on the JVM
Twitter: @patriknw

Reply all
Reply to author
Forward
0 new messages