Class/Object

agora.rest.worker

WorkContext

Related Docs: object WorkContext | package worker

Permalink

case class WorkContext[T](exchange: Exchange, routes: DynamicWorkerRoutes, subscriptionKey: Option[SubscriptionKey], subscription: WorkSubscription, requestContext: RequestContext, request: T)(implicit evidence$1: FromRequestUnmarshaller[T]) extends Product with Serializable

Wraps the input to a computation, allowing the computation (mostly) to call 'request(n)' so it can request more work.

This class is analogous to a Subscription in Reactive Streams

T

the request type

exchange

the interface to an exchange so it can request more work or even cancel the subscription or return the job

routes

the worker routes containing this handler

subscription

the details of the subscription

requestContext

the http request context which contains the original HttpRequest, etc

request

the unmarshalled handler input

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WorkContext
  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 WorkContext(exchange: Exchange, routes: DynamicWorkerRoutes, subscriptionKey: Option[SubscriptionKey], subscription: WorkSubscription, requestContext: RequestContext, request: T)(implicit arg0: FromRequestUnmarshaller[T])

    Permalink

    exchange

    the interface to an exchange so it can request more work or even cancel the subscription or return the job

    routes

    the worker routes containing this handler

    subscription

    the details of the subscription

    requestContext

    the http request context which contains the original HttpRequest, etc

    request

    the unmarshalled handler input

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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def asResponse[A](compute: ⇒ A)(implicit arg0: ToResponseMarshaller[A]): Future[HttpResponse]

    Permalink
  6. def become(newHandler: (WorkContext[T]) ⇒ Unit): Boolean

    Permalink

    Replace the current handler logic with the new handler

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  8. def complete[A](compute: ⇒ A)(implicit arg0: ToResponseMarshaller[A]): WorkContext[T]

    Permalink

    Completing the request means sending a response back to the client and requesting another work item.

    Completing the request means sending a response back to the client and requesting another work item.

    The inner 'complete' thunk is lazy, so another work item will be requested even if the given lazily-evaluated return value throws an exception.

    compute

    the lazy value to return, and upon the completion of which a new work item will be requested

    returns

    this context (builder pattern)

  9. def completeReplyOnly[A](compute: ⇒ A)(implicit arg0: ToResponseMarshaller[A]): WorkContext[T]

    Permalink

    completes this request, but doesn't request any more work from the exchange

    completes this request, but doesn't request any more work from the exchange

    compute

    the result

    returns

    this work context

  10. def completeWith[A](respFuture: Future[A], numberToRequest: Int = 1)(implicit arg0: ToResponseMarshaller[A]): WorkContext[T]

    Permalink

    By calling 'completeWith', it assures that another work item will be requested when this future completes (whether successfully or not)

    By calling 'completeWith', it assures that another work item will be requested when this future completes (whether successfully or not)

    A

    the response type

    respFuture

    the response with which will be marshalled back to the client (and upon who's completion a new work item will be requested)

    returns

    this context (builder pattern)

  11. def completeWithJson[A](value: ⇒ A)(implicit enc: Encoder[A]): WorkContext[T]

    Permalink

    complete with the json value

    complete with the json value

    value

    the value to complete

    returns

    this context (builder pattern)

  12. def completeWithSource(dataSource: Source[ByteString, Any], contentType: ContentType = `application/octet-stream`, numberToRequest: Int = 1): WorkContext[T]

    Permalink

    A convenience method to complete (return a result and request a new work item) with a byte source

  13. def details: WorkerDetails

    Permalink

    returns

    the subscription details

  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. val exchange: Exchange

    Permalink

    the interface to an exchange so it can request more work or even cancel the subscription or return the job

  16. def flatMapMultipart[A](f: PartialFunction[(MultipartInfo, Source[ByteString, Any]), Future[A]])(implicit ev: =:=[T, FormData]): Future[Seq[A]]

    Permalink
  17. def foreachMultipart[A](f: PartialFunction[(MultipartInfo, Source[ByteString, Any]), A])(implicit ev: =:=[T, FormData]): Future[Seq[A]]

    Permalink

    returns

    a value 'A' for each multipart info/source pair to which this partial function applies

  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def map[A](f: (T) ⇒ A)(implicit arg0: FromRequestUnmarshaller[A]): WorkContext[A]

    Permalink
  21. def mapFirstMultipart[A](f: PartialFunction[(MultipartInfo, Source[ByteString, Any]), A])(implicit ev: =:=[T, FormData]): Future[A]

    Permalink
  22. def mapMultipart[A](f: PartialFunction[(MultipartInfo, Source[ByteString, Any]), A])(implicit ev: =:=[T, FormData]): Future[Seq[A]]

    Permalink
  23. val matchDetails: Option[MatchDetails]

    Permalink

    The match details associated with this request invocation.

    The match details associated with this request invocation. As the endpoint is just a normal endpoint which could be invoked directly w/o having been redirected from an Exchange, it could be empty.

    The MatchDetails are provided by values taken from the Http Headers.

  24. final def ne(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  27. def path: String

    Permalink

    returns

    the path specified for the handler

  28. def replaceSubscription(newSubscription: WorkSubscription): Future[WorkContext[T]]

    Permalink

    Replace the current subscription, effectively cancelling/creating a new subscription.

    Replace the current subscription, effectively cancelling/creating a new subscription.

    newSubscription

    the new subscription

    returns

    the updated work context w/ the new work subscription

    Note

    The new subscription will be created, but no initial work items will be requested

  29. def request(n: Int): Option[Future[RequestWorkAck]]

    Permalink

    n

    the number of work items to request (typically 1, as we take one for each one we compute)

    returns

    the Ack (if we indeed had a subscription key)

  30. val request: T

    Permalink

    the unmarshalled handler input

  31. val requestContext: RequestContext

    Permalink

    the http request context which contains the original HttpRequest, etc

  32. def responseFuture: Future[HttpResponse]

    Permalink
  33. val routes: DynamicWorkerRoutes

    Permalink

    the worker routes containing this handler

  34. val subscription: WorkSubscription

    Permalink

    the details of the subscription

  35. val subscriptionKey: Option[SubscriptionKey]

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

    Permalink
    Definition Classes
    AnyRef
  37. def updateSubscription(f: (WorkSubscription) ⇒ WorkSubscription): Future[WorkContext[T]]

    Permalink

    Convenience function for 'replaceSubscription' which operates on the current subscription

    Convenience function for 'replaceSubscription' which operates on the current subscription

    f

    the update subscription

    returns

    the updated context with the new subscription

  38. def updateSubscription(update: UpdateSubscription): Future[UpdateSubscriptionAck]

    Permalink

    update the subscription which made this request using the given name/data value

    update the subscription which made this request using the given name/data value

    update

    the subscription update

    returns

    a future of the update

  39. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped