akka message flow

32 views
Skip to first unread message

Kostas kougios

unread,
Jun 1, 2015, 11:09:37 AM6/1/15
to akka...@googlegroups.com
Hi, I need to create a flow of messages, my current usecase is that I get a msg in one of my actors which in turn has to send a similar message to the cluster (I am also using akka-cluster) and upon confirmation from all cluster members to do some local changes and then reply back to the sender. But my use case might become more complex in the future.

So apart from using a separate FSM actor (my current actor is not FSM), is there any higher level api that can do

broadcast(msg).expectFromAll { case Reply=> true }.andThen(... do local changes...).andThen(reply to sender).onTimeout(...fail...)

a bit of googling didn't reveal anything like that.

Thanks

Akka Team

unread,
Jun 7, 2015, 6:13:52 AM6/7/15
to Akka User List
Hi Kostas,

Currently there is no such DSL, but this is actually something we already started experimenting with. I hope that we can come up with something easy to use in the near future.

-Endre

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> 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/d/optout.



--
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

Konstantinos Kougios

unread,
Jun 7, 2015, 2:00:44 PM6/7/15
to akka...@googlegroups.com
Hi Endre,

Yes I think it will be very useful. Though I currently can easily send messages in my akka cluster, I can't orchestrate a process that requires multiple messages to be send via several actors and the receipts to be collected. Doing so with just a series of messages becomes tedious (a lot of testing and the intent of the code is lost).

I did an impl so far of a flow engine, using an FSM actor. It makes msg exchange as a flow that takes an input (Sync of an index creation operation), sends it around the cluster, expects 1 reply from each remote actor and sends a msg to the master actor on success or a timeout msg (to all remote actors & master) on failure. Kind of like

            val keepers:Seq[Future[ActorRef]] = ... actor refs obtained via context.actorSelection(path).resolveOne(timeout)
            val flow=Flow.start(5 seconds) 
                .sendToAllF(keepers)
                .expectNMessages(keepers.size) {
                    case SyncAck(index)=>
                        ..... got ack
                }

             flow.execute(SyncAck(index))
                .onSuccess { in=>
                    ...
                }.onTimeout {
                    ...
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/GWaCwMQDqTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages