0

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?

bonzaster
  • 313
  • 2
  • 12

1 Answers1

1

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.

Bartosz Sypytkowski
  • 7,463
  • 19
  • 36
  • Thanks for the answer, I'll take a look at the Akka.Streams. Actually, I'm using DI, so it's not so easy to put actor ref to constructor. I decided to set DataStoreActor ref for ProcessingActor by sending Configure message with DataStoreActor reference. – bonzaster Nov 18 '16 at 11:22