my project requires processing of incoming events in order received , no out of sequence happens.
is use case addressed akka.
messages events processed or pushed actor in order received in mailbox. see discussion: message ordering
actor a1 sends messages m1, m2, m3 a2
actor a3 sends messages m4, m5, m6 a2
this means that:
- m1 delivered must delivered before m2 , m3
- if m2 delivered must delivered before m3
- if m4 delivered must delivered before m5 , m6
- if m5 delivered must delivered before m6
- a2 can see messages a1 interleaved messages a3
- since there no guaranteed delivery, of messages may dropped, i.e. not arrive @ a2
it's possible use stash
trait allow message m2 processed when m1 has been processed independently of order sent actor. insuring processing order. see more stash. example below written in scala.
class myactor extends actor stash { override def receive: receive = receivem1 def receivem1: receive = { case m1 => // staff m1 unstashall() context become receivem2 case _ => stash() } def receivem2: receive = { case m2 => // staff m2 } }
Comments
Post a Comment