Class DefaultReactorQueryGateway
- All Implemented Interfaces:
DescribableComponent,ReactorQueryGateway
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 Summary
ConstructorsConstructorDescriptionDefaultReactorQueryGateway(QueryGateway queryGateway, MessageTypeResolver messageTypeResolver) Instantiate aDefaultReactorQueryGatewaywithout dispatch interceptors.DefaultReactorQueryGateway(QueryGateway queryGateway, MessageTypeResolver messageTypeResolver, List<ReactorMessageDispatchInterceptor<? super QueryMessage>> dispatchInterceptors) Instantiate aDefaultReactorQueryGateway. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.<R> reactor.core.publisher.Mono<R> query(Object query, Class<R> responseType, @Nullable ProcessingContext context) Sends the givenqueryin the providedcontext(if available) and returns aMonowith a single typed result.<R> reactor.core.publisher.Mono<List<R>> queryMany(Object query, Class<R> responseType, @Nullable ProcessingContext context) Sends the givenqueryin the providedcontext(if available) and returns aMonowith a list of typed results.<R> reactor.core.publisher.Flux<R> streamingQuery(Object query, Class<R> responseType, @Nullable ProcessingContext context) Sends the givenqueryin the providedcontext(if available) as a streaming query, returning results as aFlux.<R> reactor.core.publisher.Flux<R> subscriptionQuery(Object query, Class<R> responseType, @Nullable ProcessingContext context) Sends the givenqueryin the providedcontext(if available) as a subscription query, combining the initial result and subsequent updates as aFlux.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.extension.reactor.messaging.queryhandling.gateway.ReactorQueryGateway
query, queryMany, streamingQuery, subscriptionQuery
-
Constructor Details
-
DefaultReactorQueryGateway
public DefaultReactorQueryGateway(QueryGateway queryGateway, MessageTypeResolver messageTypeResolver, List<ReactorMessageDispatchInterceptor<? super QueryMessage>> dispatchInterceptors) Instantiate aDefaultReactorQueryGateway.- Parameters:
queryGateway- theQueryGatewayto delegate query dispatching tomessageTypeResolver- theMessageTypeResolverfor resolving message typesdispatchInterceptors- the list ofReactorMessageDispatchInterceptors to apply to queries
-
DefaultReactorQueryGateway
public DefaultReactorQueryGateway(QueryGateway queryGateway, MessageTypeResolver messageTypeResolver) Instantiate aDefaultReactorQueryGatewaywithout dispatch interceptors.- Parameters:
queryGateway- theQueryGatewayto delegate query dispatching tomessageTypeResolver- theMessageTypeResolverfor resolving message types
-
-
Method Details
-
query
public <R> reactor.core.publisher.Mono<R> query(Object query, Class<R> responseType, @Nullable ProcessingContext context) Description copied from interface:ReactorQueryGatewaySends the givenqueryin the providedcontext(if available) and returns aMonowith a single typed result.- Specified by:
queryin interfaceReactorQueryGateway- Type Parameters:
R- the response type- Parameters:
query- the query payload to sendresponseType- the expected response typecontext- the processing context, if any, to dispatch the givenqueryin- Returns:
- a
Monocompleting 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:ReactorQueryGatewaySends the givenqueryin the providedcontext(if available) and returns aMonowith a list of typed results.- Specified by:
queryManyin interfaceReactorQueryGateway- Type Parameters:
R- the element type- Parameters:
query- the query payload to sendresponseType- the expected element typecontext- the processing context, if any, to dispatch the givenqueryin- Returns:
- a
Monocompleting 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:ReactorQueryGatewaySends the givenqueryin the providedcontext(if available) as a streaming query, returning results as aFlux.- Specified by:
streamingQueryin interfaceReactorQueryGateway- Type Parameters:
R- the element type- Parameters:
query- the query payload to sendresponseType- the expected element typecontext- the processing context, if any, to dispatch the givenqueryin- Returns:
- a
Fluxstreaming query results
-
subscriptionQuery
public <R> reactor.core.publisher.Flux<R> subscriptionQuery(Object query, Class<R> responseType, @Nullable ProcessingContext context) Description copied from interface:ReactorQueryGatewaySends the givenqueryin the providedcontext(if available) as a subscription query, combining the initial result and subsequent updates as aFlux.- Specified by:
subscriptionQueryin interfaceReactorQueryGateway- Type Parameters:
R- the response type- Parameters:
query- the query payload to sendresponseType- the response type for both initial result and updatescontext- the processing context, if any, to dispatch the givenqueryin- Returns:
- a
Fluxstreaming the initial result followed by updates
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods 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
DescribableComponentimplementation 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 thedescribeTomethod, 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:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-