On 15/03/2017 16:26, 'Johannes Rudolph' via Akka User List wrote:
> yes, that's a valid use case. The route tree is usually traversed
> completely until a Route matches. But if you know that the search can be
> cut short, then `seal` is definitely a good solution.
That's exactly the case here - once the request authentication has
succeeded (multiple forms are provided) then there's no point
backtracking into it as any subsequent errors are path, parameter, data
etc problems.
> Another solution would be to use only `handleRejections` which would
> have the advantage that only rejections are handled and exceptions
> will still bubble up and run through the exception handlers you have
> defined further up in your route.
I started by using an implicit rejection handler but had to switch to an
explicit handleRejections directive for some reason I don't understand.
I moved the implicit handler into a base class of the classes that are
providing the route segments and since then it's not being picked up,
even though the docs for implicit resolution say that base classes are
in the search path. I haven't figured out what the problem is, but as an
explicit handler is clearer anyway, I'm tempted to just move on.
I'm writing an emulation of multiple instances of an existing REST
service, for testing purposes. It's rather neat to see 1000 Akka-based
REST services running inside a single JVM :-) At the moment it's just at
the "hello world" stage so memory & CPU will increase but I have no
reason to believe I won't be able to support many hundreds of emulated
services from a single JVM, and there's Akka clustering for beyond that.
--
Alan Burlison
--