[akka-user] Re: Context of event stream elements

2015-05-15 Thread Jakub Liska
I'm facing also this problem with passing a context through the stream. Let 
say you have a stream like this : 

download resource - back it up - parse it - store errors - process data 
 - ... - persist data - sink


you kinda need some sort of context so that you know that if some latter 
flows fails it was related to a particular resource from the first Flow and 
you can log/handle it in Supervision.Decider. 

I'm using HList for the InOut Flow types which is basically the context so 
that instead of gluing flow parts together with many case classes for 
instance I use a growing HList. But it turned out to be quite a maintenance 
disaster and it is getting out of control because it lost flexibility. I 
think that each stream should optionally have something like a 
Context/GlobalState accessible to all Flows, even if it was a god damn 
Map[String, Any] because it is impossible to implement it manually for it 
to be maintainable.

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


[akka-user] Re: Context of event stream elements

2015-03-14 Thread Matthew
In case anybody stumbles on this.  I solved this by using Unzip then a Zip. 
 Not sure if it is the proper way to do it...  Anyway, the program I wrote 
downloads files from PipeDrive which resulted in a few fairly complex flows 
- one even has a cycle in it.  Would love some feedback on it if anybody 
has the time:

https://gist.github.com/matthewpflueger/7059483cb0809c8bc91a


On Wednesday, March 11, 2015 at 4:29:09 PM UTC-4, Matthew wrote:

 I'm a newbie with Akka Streams so please excuse me if the question seems 
 stupid.  I have the need to pass some context info along with the events in 
 a stream.  For example, I have something like the following (doesn't 
 compile - just for illustration):


 case class RequestFile(
 req: HttpRequest,
 fileId: Int,
 fileName: String)


 case class ResponseFile(
   res: HttpResponse,
   fileId: Int,
   fileName: String)

 val connection: Flow[HttpRequest, HttpResponse, 
 Future[OutgoingConnection]] =  Http().outgoingConnection(api.mydomain.com
 )


 val downloadFile: Flow[RequestFile, ResponseFile, Unit] =
   Flow[RequestFile]
   .map(_.req)
   .via(connection)
   .map { res = ResponseFile(res, , ) } //here I don't 
 know how to reference the original RequestFile to get the fileId and 
 fileName



 Has anybody else dealt with this sort of issue?






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