Hi Giovanni,
Firstly, sorry we don't have docs on this yet, but they are coming soon! (
check this with a higher version number soon
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/http/custom-directives.html
)
Both these directives are implemented in terms of the extract directrive,
by digging a bit through the sources you'll notice the patterns :-)
Something among the lines:
def extractBoth: Directive[(ExecutionContext, FlowMaterializer)] =
textract(rc => (rc.executionContext, rc.flowMaterializer))
extractBoth { (ec, mat) =>
// ec.execute()
// mat.materialize()
}
Should do the trick.
Happy hakking!
On Mon, May 18, 2015 at 8:10 PM, Giovanni Alberto Caporaletti <
[email protected]> wrote:
> Hi everyone,
>
> I often need to have both the materializer and the execution context in
> scope in my routes.
>
> Is there a more compact way of doing this?
>
> extractFlowMaterializer { implicit mat =>
> extractExecutionContext { implicit ec =>
>
> or
>
> extractFlowMaterializer { implicit mat =>
> implicit val ec = mat.executionContext
>
>
>
> I tried something like (extractFlowMaterializer & extractExecutionContext)
> { implicit (mat, val) => ... but it doesn't work
>
>
>
> thanks
> G
>
> --
> >>>>>>>>>> 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.
>
--
Cheers,
Konrad 'ktoso' Malawski
Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>
--
>>>>>>>>>> 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.