Interface QueryGateway
- All Superinterfaces:
MessageDispatchInterceptorSupport<QueryMessage<?,?>>
- All Known Implementing Classes:
DefaultQueryGateway
- Since:
- 3.1
- Author:
- Marc Gathier, Allard Buijze, Steven van Beelen, Milan Savic
-
Method Summary
Modifier and TypeMethodDescriptiondefault <R,Q> CompletableFuture <R> Sends givenqueryover theQueryBus, expecting a response with the givenresponseTypefrom a single source.<R,Q> CompletableFuture <R> query(String queryName, Q query, ResponseType<R> responseType) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom a single source.default <R,Q> CompletableFuture <R> Sends givenqueryover theQueryBus, expecting a response with the givenresponseTypefrom a single source.default <R,Q> CompletableFuture <R> query(Q query, ResponseType<R> responseType) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom a single source.<R,Q> Stream <R> scatterGather(String queryName, Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom several sources.default <R,Q> Stream <R> scatterGather(Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom several sources.<R,Q> org.reactivestreams.Publisher <R> streamingQuery(String queryName, Q query, Class<R> responseType) default <R,Q> org.reactivestreams.Publisher <R> streamingQuery(Q query, Class<R> responseType) default <Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(String queryName, Q query, Class<I> initialResponseType, Class<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).default <Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).<Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType, int updateBufferSize) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).default <Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure) Deprecated.<Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure, int updateBufferSize) Deprecated.in favour of using {subscriptionQuery(String, Object, ResponseType, ResponseType, int)}.default <Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(Q query, Class<I> initialResponseType, Class<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).default <Q,I, U> SubscriptionQueryResult <I, U> subscriptionQuery(Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Methods inherited from interface org.axonframework.messaging.MessageDispatchInterceptorSupport
registerDispatchInterceptor
-
Method Details
-
query
Sends givenqueryover theQueryBus, expecting a response with the givenresponseTypefrom a single source. The query name will be derived from the providedquery. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
query- Thequeryto be sentresponseType- AClassdescribing the desired response type- Returns:
- A
CompletableFuturecontaining the query result as dictated by the givenresponseType
-
query
default <R,Q> CompletableFuture<R> query(@Nonnull String queryName, @Nonnull Q query, @Nonnull Class<R> responseType) Sends givenqueryover theQueryBus, expecting a response with the givenresponseTypefrom a single source. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
queryName- AStringdescribing the query to be executedquery- Thequeryto be sentresponseType- TheResponseTypeused for this query- Returns:
- A
CompletableFuturecontaining the query result as dictated by the givenresponseType
-
query
Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom a single source. The query name will be derived from the providedquery. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
query- Thequeryto be sentresponseType- TheResponseTypeused for this query- Returns:
- A
CompletableFuturecontaining the query result as dictated by the givenresponseType
-
query
<R,Q> CompletableFuture<R> query(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<R> responseType) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom a single source. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
queryName- AStringdescribing the query to be executedquery- Thequeryto be sentresponseType- TheResponseTypeused for this query- Returns:
- A
CompletableFuturecontaining the query result as dictated by the givenresponseType
-
streamingQuery
Sends givenqueryover theQueryBus, expecting a response asPublisherofresponseType. Query is sent oncePublisheris subscribed to. The Streaming query allows a client to stream large result sets. Usage of this method requires Project Reactor on the class path.Publisheris used for backwards compatibility reason, for clients that don't have Project Reactor on class path. Check Reactor Extension for native Flux type and more. UseFlux.from(publisher)to convert to Flux stream.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
query- Thequeryto be sentresponseType- AClassdescribing the desired response type- Returns:
- A
Publisherstreaming the results as dictated by the givenresponseType
-
streamingQuery
<R,Q> org.reactivestreams.Publisher<R> streamingQuery(String queryName, Q query, Class<R> responseType) Sends givenqueryover theQueryBus, expecting a response asPublisherofresponseType. Query is sent oncePublisheris subscribed to. The Streaming query allows a client to stream large result sets. Usage of this method requires Project Reactor on the class path.Publisheris used for backwards compatibility reason, for clients that don't have Project Reactor on class path. Check Reactor Extension for native Flux type and more. UseFlux.from(publisher)to convert to Flux stream.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
queryName- AStringdescribing the query to be executedquery- Thequeryto be sentresponseType- AClassdescribing the desired response type- Returns:
- A
Publisherstreaming the results as dictated by the givenresponseType.
-
scatterGather
default <R,Q> Stream<R> scatterGather(@Nonnull Q query, @Nonnull ResponseType<R> responseType, long timeout, @Nonnull TimeUnit timeUnit) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom several sources. The stream is completed when atimeoutoccurs or when all results are received. The query name will be derived from the providedquery. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
query- Thequeryto be sentresponseType- TheResponseTypeused for this querytimeout- A timeout oflongfor the querytimeUnit- The selectedTimeUnitfor the giventimeout- Returns:
- A stream of results.
-
scatterGather
<R,Q> Stream<R> scatterGather(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<R> responseType, long timeout, @Nonnull TimeUnit timeUnit) Sends givenqueryover theQueryBus, expecting a response in the form ofresponseTypefrom several sources. The stream is completed when atimeoutoccurs or when all results are received. Execution may be asynchronous, depending on the QueryBus implementation.- Type Parameters:
R- The response class contained in the givenresponseTypeQ- The query class- Parameters:
queryName- AStringdescribing the query to be executedquery- Thequeryto be sentresponseType- TheResponseTypeused for this querytimeout- A timeout oflongfor the querytimeUnit- The selectedTimeUnitfor the giventimeout- Returns:
- A stream of results.
-
subscriptionQuery
default <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull Q query, @Nonnull Class<I> initialResponseType, @Nonnull Class<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- The type of the queryI- The type of the initial responseU- The type of the incremental update- Parameters:
query- Thequeryto be sentinitialResponseType- The initial response type used for this queryupdateResponseType- The update response type used for this query- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
default <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull String queryName, @Nonnull Q query, @Nonnull Class<I> initialResponseType, @Nonnull Class<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- The type of the queryI- The type of the initial responseU- The type of the incremental update- Parameters:
queryName- AStringdescribing query to be executedquery- Thequeryto be sentinitialResponseType- The initial response type used for this queryupdateResponseType- The update response type used for this query- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
default <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull Q query, @Nonnull ResponseType<I> initialResponseType, @Nonnull ResponseType<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- The type of the queryI- The type of the initial responseU- The type of the incremental update- Parameters:
query- Thequeryto be sentinitialResponseType- The initial response type used for this queryupdateResponseType- The update response type used for this query- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
@Deprecated default <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<I> initialResponseType, @Nonnull ResponseType<U> updateResponseType, @Nullable SubscriptionQueryBackpressure backpressure) Deprecated.in favour of using {subscriptionQuery(String, Object, ResponseType, ResponseType)}. To set a backpressure strategy, use one of theonBackpressure..operators on the updates flux directly. Example:result.updates().onBackpressureBuffer(100)Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- The type of the queryI- The type of the initial responseU- The type of the incremental update- Parameters:
queryName- AStringdescribing query to be executedquery- Thequeryto be sentinitialResponseType- The initial response type used for this queryupdateResponseType- The update response type used for this querybackpressure- The backpressure mechanism to deal with producing of incremental updates- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
default <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<I> initialResponseType, @Nonnull ResponseType<U> updateResponseType) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, will be filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- the type of the queryI- the type of the initial responseU- the type of the incremental update- Parameters:
queryName- aStringdescribing query to be executedquery- thequeryto be sentinitialResponseType- the initial response type used for this queryupdateResponseType- the update response type used for this query- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
@Deprecated <Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<I> initialResponseType, @Nonnull ResponseType<U> updateResponseType, @Nullable SubscriptionQueryBackpressure backpressure, int updateBufferSize) Deprecated.in favour of using {subscriptionQuery(String, Object, ResponseType, ResponseType, int)}. To set a backpressure strategy, use one of theonBackpressure..operators on the updates flux directly. Example:result.updates().onBackpressureBuffer(100)Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- The type of the queryI- The type of the initial responseU- The type of the incremental update- Parameters:
queryName- AStringdescribing query to be executedquery- Thequeryto be sentinitialResponseType- The initial response type used for this queryupdateResponseType- The update response type used for this querybackpressure- The backpressure mechanism to deal with producing of incremental updatesupdateBufferSize- The size of buffer which accumulates updates before subscription to the flux is made- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery
<Q,I, SubscriptionQueryResult<I,U> U> subscriptionQuery(@Nonnull String queryName, @Nonnull Q query, @Nonnull ResponseType<I> initialResponseType, @Nonnull ResponseType<U> updateResponseType, int updateBufferSize) Sends givenqueryover theQueryBusand returns result containing initial response and incremental updates (received at the moment the query is sent, until it is cancelled by the caller or closed by the emitting side).Note: Any
nullresults, on the initial result or the updates, wil lbe filtered out by the QueryGateway. If you require thenullto be returned for the initial and update results, we suggest using theQueryBusinstead.- Type Parameters:
Q- the type of the queryI- the type of the initial responseU- the type of the incremental update- Parameters:
queryName- aStringdescribing query to be executedquery- thequeryto be sentinitialResponseType- the initial response type used for this queryupdateResponseType- the update response type used for this queryupdateBufferSize- the size of buffer which accumulates updates before subscription to the flux is made- Returns:
- registration which can be used to cancel receiving updates
- See Also:
-
subscriptionQuery(String, Object, ResponseType, ResponseType)}.