Hi,

I am using Play Framework 2.5.x Java. I have a use case where I need to 
create a process that,

1. Polls Amazon SQS for message(s)
2. For each message, download some file from S3.
3. Update Mongo with new data as per message.
4. Delete the message from SQS.

I have already created non-blocking APIs for all the steps. The APIs 
produce a CompletionStage object. I am evaluating options modeling this 
processing using Akka Actors.

I am thinking about following options,

1. Scheduler:
 - A scheduler will trigger an actor to poll for messages.
 - I will use the CompletionStage returned by the receive message API to 
weave together further steps asynchronously.

2. Scheduler + Message Processing Actor
 - A scheduler will trigger an actor to poll for messages.
 - Each message will be pushed (tell) to an actor which processes the 
messages.
 - Message processing actor will use chaining of CompletionStage to process 
the message asynchronously. 

3. Scheduler + Message Processing Actor per message
 - A scheduler will trigger an actor to poll for messages.
 - Each message will be pushed (tell) to it's dedicated instance of an 
actor which processes the messages.
 - Message processing actor will use chaining of CompletionStage to process 
the message asynchronously. 

I have following questions,

1. As per scheduler's documentation, the scheduler will fire as per fixed 
schedule. It is possible that there are 2 polls of SQS happening at the 
same time in case the amount of time required by a single poll exceeds 
scheduler's interval. Ideally I need a construct which triggers another 
poll only after the first one is complete (closely related to a loop) What 
is the best way to achieve this? I have also thought about an actor 
messaging itself after it has performed 1 poll.

2. It is mentioned in the documentation that an actor should not process 
next message until the current message is processed. If I use chaining of 
CompletionStage, I will be returning from the onReceive() method of actor 
prematurely. Is this acceptable? If not, what is an alternative? How do I 
chain the CompletionStage to weave further operations on the result? I did 
read about pipe. I can pipe the CompletionStage to the same / another actor 
to perform the next step. Even if I use pipe, I am still allowing another 
message into onReceive before the previous one is actually completed 
processing?

Any suggestions how this process should be modeled for Akka?

Thanks,

Kalpak

-- 
>>>>>>>>>>      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+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to