bonzaster
bonzaster

Reputation: 343

How to test actor which not send anything to sender

I have following message flow ConnectionActor -(RawMessage)-> ParserActor -(ParsedMessage)-> ProcessingActor -(DataMessage)-> DataStoreActor.

I want to test that my ProcessingActor sends proper DataMessage when ParserActor received some particular RawMessage. Is it possible to do it using Akka.TestKit?

Upvotes: 0

Views: 64

Answers (1)

Bartosz Sypytkowski
Bartosz Sypytkowski

Reputation: 7542

Before going further, I'd encourage you to take a look at Akka.Streams to evaluate, if your stream processing couldn't be made easier and faster with that.

Given that, you could simply express a link between two actors in your flow as i.e. IActorRef passed to actor's constructor like public ParserActor(IActorRef processingActor). This way you can keep components of your flow separate and mock the connection between them using standard test probe or actor.

Upvotes: 1

Related Questions