Class/Object

agora.rest.worker

DynamicWorkerRoutes

Related Docs: object DynamicWorkerRoutes | package worker

Permalink

case class DynamicWorkerRoutes(exchange: Exchange, defaultSubscription: WorkSubscription, defaultInitialRequest: Int)(implicit mat: Materializer) extends Product with Serializable

Self Type
DynamicWorkerRoutes
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DynamicWorkerRoutes
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DynamicWorkerRoutes(exchange: Exchange, defaultSubscription: WorkSubscription, defaultInitialRequest: Int)(implicit mat: Materializer)

    Permalink

Type Members

  1. class OnWork[T] extends AnyRef

    Permalink

    Captures the 'handler' logic for a subscription.

    Captures the 'handler' logic for a subscription.

    Attributes
    protected

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addHandler[T](onReq: (WorkContext[T]) ⇒ Unit)(implicit subscription: WorkSubscription = defaultSubscription, initialRequest: Int = defaultInitialRequest, fromRequest: FromRequestUnmarshaller[T]): Future[RequestWorkAck]

    Permalink

    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

    T

    the request input type

    onReq

    the compute functions

    subscription

    the subscription to use when asking for work for this computation

    initialRequest

    how many work items to initially ask for

    returns

    a future of the 'request work' ack

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. val defaultInitialRequest: Int

    Permalink
  8. val defaultSubscription: WorkSubscription

    Permalink
  9. implicit val ec: ExecutionContextExecutor

    Permalink
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. val exchange: Exchange

    Permalink
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def find(workerName: String): Option[OnWork[_]]

    Permalink
    Attributes
    protected
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def handleWorkRoute: Route

    Permalink
  16. def health: Route

    Permalink
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def listSubscriptions: Route

    Permalink
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. def routes: Route

    Permalink

    returns

    the REST route

  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. def updateHandler[T](path: String)(onReq: (WorkContext[T]) ⇒ Unit)(fromRequest: FromRequestUnmarshaller[T]): Boolean

    Permalink

    Replace the handler logic for the handler at the given path

    Replace the handler logic for the handler at the given path

    T

    the handler body type

    path

    the relative path snippet for the handler to replace

    onReq

    the new handler logic

    fromRequest

    the unmarshaller to use

    returns

    true if a handler was previously registered at the given path (and thus replaced)

  25. def usingSubscription(f: (WorkSubscription) ⇒ WorkSubscription): WithSubscriptionWord

    Permalink

    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"))
    f

    a function which modifies the default subscription (or completely ignores it)

    returns

    A DSL-specific class which expects 'addHandler' to be called on it

  26. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. def withSubscription(s: WorkSubscription): WithSubscriptionWord

    Permalink

    Like 'usingSubscription', this function provides a DSL for adding a handler.

    Like 'usingSubscription', this function provides a DSL for adding a handler.

    s

    the work subscription used for the handler

    returns

    A DSL-specific class which expects 'addHandler' to be called on it

  30. var workerByPath: Map[String, OnWork[_]]

    Permalink
    Attributes
    protected
  31. def workerPaths: Set[String]

    Permalink

    returns

    the registered worker paths

  32. def workerRoutes: Route

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped