val zipper = BidiFlow.fromGraph(GraphDSL.create() { b =>
var counter = 0
val outbound = b.add(Flow[String].map { str =>
counter += 1
str -> counter
})
val inbound = b.add(Flow[(String, Int)].map { pair =>
counter -= 1
pair._1
})
BidiShape.fromFlows(outbound, inbound)
})
--
>>>>>>>>>> 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 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 akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
--Cheers,√
2 Konrad: Yep, in original question I meant not 'DSL construction time' but 'execution time' thread-safety. Thanks for clarification.2 Victor: Use case is simple: outgoing flow need to store `Promise` of future remote response in some shared state which then would be completed by incoming flow.
There could be as many promises as there were outgoing messages, but the order of responses are not guaranteed and there could be additional messages in incoming flow.What do you meant by 'actively prevents multiple materializations'?
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
1. Flow itself is a bidi-codec from ByteString to our own Request/Response entities. Each Request has Promise[Response] attribute. Shared state is more like Map[Request.Id, Promise[Response]] -- because order of Responses are not guarantied.
2. It should have state shared only "inside" this one materialized flow.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Ok, so a sort of "correlator"-stage?
Yes, so the BidiFlow you create has shared state tied to the intance, not the mateiralization.I think you'll need to create a custom GraphStage with a BidiShape.