I have an application that pulls data from an external system using HTTP 
GET requests, the headers of which include an OAuth 2.0 access token. I'm 
trying to work out what to do when access tokens expire, as they do from 
time to time.

I suppose I could let the stream complete with failure, and the class that 
created the stream could detect that the failure was due to token expiry, 
and it could do the OAuth 2.0 refresh token dance to get a new access 
token, and then re-create the stream. It feels wrong, though, because what 
about all the nice little elements in transit at the time of the failure? 
They'll just fall on the floor and die. Sad.

And then I read about supervision strategies, and I'm thinking Yeah! that's 
right, I only need to restart the stage, and all the nice little elements 
can just wait while I do the refresh dance. But then I don't like the idea 
of having the decider function - the function that chooses the 
Supervision.Directive, have side effects like OAuth 2.0 refresh dances and 
missile launches and stuff. So then I read about Custom Stream Processing: 
PushPullStage, and PushStage, and in the Akka Streams code I found a thingy 
called AsyncStage - maybe I could write a custom stage that extends that.

I feel like I'm in a room with eight closed doors, and behind one is a land 
flowing with milk and honey, or nice little elements at least, and behind 
all of the others is ritual humiliation. 

Please help me choose. Where do I put the OAuth 2.0 refresh token dance?

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to