Object

io.isomarcte.http4s.active.requests.core

ActiveRequestMiddleware

Related Doc: package core

Permalink

object ActiveRequestMiddleware

Http4s middleware which allows for introspection based on the number of active requests.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActiveRequestMiddleware
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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 activeRequestCountMiddleware[F[_], N](startReport: (N) ⇒ F[Unit], endReport: (N) ⇒ F[Unit], action: (N, Request[F]) ⇒ F[Either[Request[F], Response[F]]])(implicit F: Sync[F], N: Numeric[N]): HttpMiddleware[F]

    Permalink

    Middleware which counts the active requests and allows for an action to be taken based off the current number of active requests and the current request.

    Middleware which counts the active requests and allows for an action to be taken based off the current number of active requests and the current request.

    F

    a Sync type.

    N

    a Numeric state type, e.g. Long.

    startReport

    report the request count every time it is incremented.

    endReport

    report the request count every time it is decremented.

    action

    a function of the number of active requests and the current Request which yields either a Request or a Response. If a Response is yielded this has the effect of bypassing the underlying service.

    returns

    the middleware.

  5. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  15. def primitive[F[_]](onStart: F[Unit], onEnd: F[Unit], action: (Request[F]) ⇒ F[Either[Request[F], Response[F]]])(implicit F: Sync[F]): HttpMiddleware[F]

    Permalink

    This function provides the fundamental primitive operations on which the other functions are defined.

    This function provides the fundamental primitive operations on which the other functions are defined. It is quite a bit uglier than the higher level middlewares. Unless you have very specific needs, you should avoid using it directly.

    Fundamentally takes two effects, one to run when a request is received, and one to run when a response is emitted. It also takes an action, which is a function of the current request, which emits an effect of an Either[Request[F], Response[F]]. If a Right[Response[F]] is emitted, this will bypass calling the underlying service and immediately return the generated Response[F] value.

    F

    a Sync type.

    onStart

    an effect to run after a request is received.

    onEnd

    an effect to run after a response is emitted.

    action

    a function of the current Request which yields either a Request or a Response. If a Response is yielded this has the effect of bypassing the underlying service.

    returns

    a pair of a F[S] which can be used to inspect the current state externally and the middleware.

  16. def rejectWithResponseOverMaxMiddleware[F[_], N](startReport: (N) ⇒ F[Unit], endReport: (N) ⇒ F[Unit], onMax: F[Unit], response: Response[F])(maxConcurrentRequests: N)(implicit F: Sync[F], N: Numeric[N]): HttpMiddleware[F]

    Permalink

    Middleware which bypasses the service if there are more than a certain number of active requests.

    Middleware which bypasses the service if there are more than a certain number of active requests. When the onMax effect is invoked, this always indicates that the given Response[F] value is yielded, bypassing the underlying service.

    F

    a Sync type.

    N

    a Numeric state type, e.g. Long.

    startReport

    report the request count every time it is incremented.

    endReport

    report the request count every time it is decremented.

    onMax

    an effect to invoke if the permitted maximum number of concurrent requests is exceeded. One might use this for to log the event for example.

    response

    the Response to yield when there are too many active requests.

    maxConcurrentRequests

    the maximum number of concurrent requests to allow.

    returns

    the middleware.

  17. def serviceUnavailableMiddleware[F[_], N](maxConcurrentRequests: N)(implicit F: Sync[F], N: Numeric[N]): HttpMiddleware[F]

    Permalink

    Middleware which returns a 503 (ServiceUnavailable) response after it is processing more than a given number of requests.

    Middleware which returns a 503 (ServiceUnavailable) response after it is processing more than a given number of requests.

    F

    a Sync type.

    N

    a Numeric state type, e.g. Long.

    maxConcurrentRequests

    the maximum number of concurrent requests to allow.

    returns

    the middleware.

  18. def serviceUnavailableMiddleware_[F[_], N](startReport: (N) ⇒ F[Unit], endReport: (N) ⇒ F[Unit], onMax: F[Unit], maxConcurrentRequests: N)(implicit F: Sync[F], N: Numeric[N]): HttpMiddleware[F]

    Permalink

    Middleware which returns a 503 (ServiceUnavailable) response after it is processing more than a given number of requests.

    Middleware which returns a 503 (ServiceUnavailable) response after it is processing more than a given number of requests.

    F

    a Sync type.

    N

    a Numeric state type, e.g. Long.

    startReport

    report the request count every time it is incremented.

    endReport

    report the request count every time it is decremented.

    onMax

    an effect to invoke if the permitted maximum number of concurrent requests is exceeded. One might use this for to log the event for example.

    maxConcurrentRequests

    the maximum number of concurrent requests to allow.

    returns

    the middleware.

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

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(): 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 AnyRef

Inherited from Any

Ungrouped