Tim,
if I understand you correctly you want to have the route return a 202 response and trigger an async job that is going to be completed sometime in the future.
I can't see how you'd be able to do this without side-effecting since starting an async job and not waiting for its result seems like an inherently side-effecting task to me, no?
One comment, this:
> get {
> thingThatDoesSomeWork
> complete(HttpResponse(StatusCodes.Accepted))
> }
should be better written like this:
get {
complete {
thingThatDoesSomeWork
StatusCodes.Accepted
}
}
The two are almost equivalent but the latter is more resilient to future changes like this one for example:
get {
parameter(`someParam) { p =>
complete {
thingThatDoesSomeWork
StatusCodes.Accepted
}
}
}
which executes the `thingThatDoesSomeWork` at the "right" time, whereas this doesn't:
get {
thingThatDoesSomeWork
parameter(`someParam) { p =>
complete(StatusCodes.Accepted)
}
}
Cheers,
Mathias
---
mat...@spray.io
http://spray.io
> --
> You received this message because you are subscribed to the Google Groups "spray-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
spray-user+...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>