Captures the 'handler' logic for a subscription.
Captures the 'handler' logic for a subscription.
The main body for a handler ...
The main body for a handler ... registers a function ('onReq') which does some work.
Instead of a thinking of a generic computation as a function from A => B, This exposes the function as WorkContext[A] => ResponseEntity
The WorkContext exposes a handle onto the exchange (so the computation can request more work) and access details about the work sent to it
the request input type
the compute functions
the subscription to use when asking for work for this computation
how many work items to initially ask for
a future of the 'request work' ack
the REST route
Replace the handler logic for the handler at the given path
Replace the handler logic for the handler at the given path
the handler body type
the relative path snippet for the handler to replace
the new handler logic
the unmarshaller to use
true if a handler was previously registered at the given path (and thus replaced)
Syntactic sugar to allow users to:
Syntactic sugar to allow users to:
val routes : WorkerRoutes = ... routes.usingSubscription(XYZ).addHandler( ctxt => ... )
This is really only needed when a single worker has multiple handlers (i.e. work routes).
The implicit parameter list to addHandler() takes a WorkSubscription, which defaults to one provided from the configuration.
So, without the syntactic sugar, subsequent handlers would either need to set up another subscription in implicit scope or explicitly provide the curried implicit paramter, something akin to:
workRoute.addHandler[SomeCaseClass] { ctxt => ... }(workRoute.defaultSubscription.withPath("myNewHandler"))
a function which modifies the default subscription (or completely ignores it)
A DSL-specific class which expects 'addHandler' to be called on it
Like 'usingSubscription', this function provides a DSL for adding a handler.
Like 'usingSubscription', this function provides a DSL for adding a handler.
the work subscription used for the handler
A DSL-specific class which expects 'addHandler' to be called on it
the registered worker paths