Class ReactorPropagation

java.lang.Object
io.micronaut.core.async.propagation.ReactorPropagation

public final class ReactorPropagation extends Object
Reactor propagation of PropagatedContext.
Since:
4.0.0
Author:
Denis Stepanov
  • Field Details

    • PROPAGATED_CONTEXT_REACTOR_CONTEXT_VIEW_KEY

      public static final String PROPAGATED_CONTEXT_REACTOR_CONTEXT_VIEW_KEY
      The key to be used in the Reactor context.
      See Also:
  • Method Details

    • addPropagatedContext

      @NonNull public static @NonNull reactor.util.context.Context addPropagatedContext(@NonNull @NonNull reactor.util.context.Context context, @NonNull @NonNull PropagatedContext propagatedContext)
      Adds propagated context to the Reactors' context.
      Parameters:
      context - The context to be extended
      propagatedContext - The propagated context
      Returns:
      The modified context
    • addContextElement

      @NonNull public static @NonNull reactor.util.context.Context addContextElement(@NonNull @NonNull reactor.util.context.Context context, @NonNull @NonNull PropagatedContextElement contextElement)
      Adds a context element to the Reactor's context.
      Parameters:
      context - The context to be extended
      contextElement - The propagated context element
      Returns:
      The modified context
    • findContextElement

      public static <E extends PropagatedContextElement> Optional<E> findContextElement(@NonNull @NonNull reactor.util.context.ContextView contextView, @NonNull @NonNull Class<E> contextElementType)
      Finds the context element by the type.
      Type Parameters:
      E - The element type
      Parameters:
      contextView - The Reactor's context
      contextElementType - The element type
      Returns:
      optional context element
    • findAllContextElements

      public static <E extends PropagatedContextElement> Stream<E> findAllContextElements(@NonNull @NonNull reactor.util.context.ContextView contextView, @NonNull @NonNull Class<E> contextElementType)
      Finds all context elements by the type.
      Type Parameters:
      E - All elements if the type
      Parameters:
      contextView - The Reactor's context
      contextElementType - The element type
      Returns:
      optional context element
    • findPropagatedContext

      public static Optional<PropagatedContext> findPropagatedContext(@NonNull @NonNull reactor.util.context.ContextView contextView)
      Finds propagated context in the Reactor's context.
      Parameters:
      contextView - The context
      Returns:
      optional propagated context