Perhaps use mapAsync and complete the future after the backoff timeout? http://doc.akka.io/docs/akka/2.4/scala/futures.html#After
/Patrik tors 16 mars 2017 kl. 10:32 skrev Vishal John <[email protected]>: > > Hello all, > > > I have a application which reads a stream of "request" messages, process > them and makes API calls to Zendesk. Zendesk has a limit of 10 api > call/second. And if you hit the rate limit by any change then you will > have to wait for a specific interval of time which will be returned in the > 'X-Retry-After' header > > So I am trying to model my akka stream application like this. > > *ZendeskRequestProcesorActor extends ActorPublisher[Request]* *(Source)* > > *Flow[Request].throttle(10, 1.second, 10, ThrottleMode.shaping).map(...)* > *(Flow with throttling of API calls)* > > *ZendeskPushApiActor extends ActorSubscriber[Request]* * (Sink)* > > I have come up with this design for backpressure. > > Now my question is, if I hit the rate limit by any chance, i would like to > suspend the flow for a predefined interval and then continue. > > I am just curious how I can achieve something like that for my use case. > How to send a trigger to stop processing for some time and then start again. > > > > thanks a lot, > > Vishal > > -- > >>>>>>>>>> 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
