java.lang.Object
org.axonframework.extension.reactor.messaging.queryhandling.gateway.DefaultReactorQueryGateway
All Implemented Interfaces:
DescribableComponent, ReactorQueryGateway

public class DefaultReactorQueryGateway extends Object implements ReactorQueryGateway
Default implementation of ReactorQueryGateway.

Builds a recursive interceptor chain that runs inside the Reactor subscription, then delegates to the Axon Framework QueryGateway.

Since:
4.4.2
Author:
Milan Savic, Theo Emanuelsson
See Also:
  • Constructor Details

  • Method Details

    • query

      public <R> reactor.core.publisher.Mono<R> query(Object query, Class<R> responseType, @Nullable ProcessingContext context)
      Description copied from interface: ReactorQueryGateway
      Sends the given query in the provided context (if available) and returns a Mono with a single typed result.
      Specified by:
      query in interface ReactorQueryGateway
      Type Parameters:
      R - the response type
      Parameters:
      query - the query payload to send
      responseType - the expected response type
      context - the processing context, if any, to dispatch the given query in
      Returns:
      a Mono completing with the query result
    • queryMany

      public <R> reactor.core.publisher.Mono<List<R>> queryMany(Object query, Class<R> responseType, @Nullable ProcessingContext context)
      Description copied from interface: ReactorQueryGateway
      Sends the given query in the provided context (if available) and returns a Mono with a list of typed results.
      Specified by:
      queryMany in interface ReactorQueryGateway
      Type Parameters:
      R - the element type
      Parameters:
      query - the query payload to send
      responseType - the expected element type
      context - the processing context, if any, to dispatch the given query in
      Returns:
      a Mono completing with a list of query results
    • streamingQuery

      public <R> reactor.core.publisher.Flux<R> streamingQuery(Object query, Class<R> responseType, @Nullable ProcessingContext context)
      Description copied from interface: ReactorQueryGateway
      Sends the given query in the provided context (if available) as a streaming query, returning results as a Flux.
      Specified by:
      streamingQuery in interface ReactorQueryGateway
      Type Parameters:
      R - the element type
      Parameters:
      query - the query payload to send
      responseType - the expected element type
      context - the processing context, if any, to dispatch the given query in
      Returns:
      a Flux streaming query results
    • subscriptionQuery

      public <R> reactor.core.publisher.Flux<R> subscriptionQuery(Object query, Class<R> responseType, @Nullable ProcessingContext context)
      Description copied from interface: ReactorQueryGateway
      Sends the given query in the provided context (if available) as a subscription query, combining the initial result and subsequent updates as a Flux.
      Specified by:
      subscriptionQuery in interface ReactorQueryGateway
      Type Parameters:
      R - the response type
      Parameters:
      query - the query payload to send
      responseType - the response type for both initial result and updates
      context - the processing context, if any, to dispatch the given query in
      Returns:
      a Flux streaming the initial result followed by updates
    • describeTo

      public void describeTo(ComponentDescriptor descriptor)
      Description copied from interface: DescribableComponent
      Describe the properties of this DescribableComponent with the given descriptor.

      Components should call the appropriate describeProperty methods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.

      Best Practices: As a general rule, all relevant fields of a DescribableComponent implementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing the describeTo method, who should focus on providing information that is useful for understanding the component's configuration and state.

      Example implementation:

       public void describeTo(ComponentDescriptor descriptor) {
           descriptor.describeProperty("name", this.name);
           descriptor.describeProperty("enabled", this.enabled);
           descriptor.describeProperty("configuration", this.configuration); // A nested component
           descriptor.describeProperty("handlers", this.eventHandlers);      // A collection
       }
       
      Specified by:
      describeTo in interface DescribableComponent
      Parameters:
      descriptor - The component descriptor to describe this DescribableComponentn its properties in.