Reputation: 12024
How can I make assertion against deadletters in Akka while testing?
I have an actor which can switch behaviours (using become
) and deals with some Futures dispatched using separate Dispatcher. In some certain condition it should simply reject other messages.
Those correctly go to a deadletters, however I would like to try to assert for them (or lack of). How can I do this?
Upvotes: 1
Views: 518
Reputation: 11479
Dead letters are delivered using the event stream so you can subscribe to that in your tests with a probe and verify messages or lack of messages
system.eventStream.subscribe(probe, classOf[DeadLetter])
Upvotes: 3