public class DefaultQueryGateway extends Object implements QueryGateway
Modifier and Type | Class and Description |
---|---|
static class |
DefaultQueryGateway.Builder
Builder class to instantiate a
DefaultQueryGateway . |
Modifier | Constructor and Description |
---|---|
protected |
DefaultQueryGateway(DefaultQueryGateway.Builder builder)
Instantiate a
DefaultQueryGateway based on the fields contained in the DefaultQueryGateway.Builder . |
Modifier and Type | Method and Description |
---|---|
static DefaultQueryGateway.Builder |
builder()
Instantiate a Builder to be able to create a
DefaultQueryGateway . |
<R,Q> CompletableFuture<R> |
query(String queryName,
Q query,
ResponseType<R> responseType)
Sends given
query over the QueryBus , expecting a response in the
form of responseType from a single source. |
Registration |
registerDispatchInterceptor(MessageDispatchInterceptor<? super QueryMessage<?,?>> interceptor)
Register the given DispatchInterceptor.
|
<R,Q> Stream<R> |
scatterGather(String queryName,
Q query,
ResponseType<R> responseType,
long timeout,
TimeUnit timeUnit)
Sends given
query over the QueryBus , expecting a response in the
form of responseType from several sources. |
<Q,I,U> SubscriptionQueryResult<I,U> |
subscriptionQuery(String queryName,
Q query,
ResponseType<I> initialResponseType,
ResponseType<U> updateResponseType,
int updateBufferSize)
Sends given
query over the QueryBus and 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,
SubscriptionQueryBackpressure backpressure,
int updateBufferSize)
Deprecated.
in favour of the {
subscriptionQuery(String, Object, ResponseType, ResponseType, int) } |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
query, query, query, scatterGather, subscriptionQuery, subscriptionQuery, subscriptionQuery, subscriptionQuery, subscriptionQuery
protected DefaultQueryGateway(DefaultQueryGateway.Builder builder)
DefaultQueryGateway
based on the fields contained in the DefaultQueryGateway.Builder
.
Will assert that the QueryBus
is not null
, and will throw an AxonConfigurationException
if it is null
.
builder
- the DefaultQueryGateway.Builder
used to instantiate a DefaultQueryGateway
instancepublic static DefaultQueryGateway.Builder builder()
DefaultQueryGateway
.
The dispatchInterceptors
is defaulted to an empty list. The QueryBus
is a
hard requirement and as such should be provided.
DefaultQueryGateway
public <R,Q> CompletableFuture<R> query(String queryName, Q query, ResponseType<R> responseType)
QueryGateway
query
over the QueryBus
, expecting a response in the
form of responseType
from a single source. Execution may be asynchronous, depending on the QueryBus
implementation.query
in interface QueryGateway
R
- The response class contained in the given responseType
Q
- The query classqueryName
- A String
describing the query to be executedquery
- The query
to be sentresponseType
- The ResponseType
used for this queryCompletableFuture
containing the query result as dictated by the given
responseType
public <R,Q> Stream<R> scatterGather(String queryName, Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit)
QueryGateway
query
over the QueryBus
, expecting a response in the
form of responseType
from several sources. The stream is completed when a timeout
occurs or when
all results are received. Execution may be asynchronous, depending on the QueryBus implementation.scatterGather
in interface QueryGateway
R
- The response class contained in the given responseType
Q
- The query classqueryName
- A String
describing the query to be executedquery
- The query
to be sentresponseType
- The ResponseType
used for this querytimeout
- A timeout of long
for the querytimeUnit
- The selected TimeUnit
for the given timeout
@Deprecated public <Q,I,U> SubscriptionQueryResult<I,U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure, int updateBufferSize)
subscriptionQuery(String, Object, ResponseType, ResponseType, int)
}QueryGateway
query
over the QueryBus
and 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 null
results, on the initial result or the updates, wil lbe filtered out by the
QueryGateway. If you require the null
to be returned for the initial and update results, we suggest using
the QueryBus
instead.
subscriptionQuery
in interface QueryGateway
Q
- The type of the queryI
- The type of the initial responseU
- The type of the incremental updatequeryName
- A String
describing query to be executedquery
- The query
to 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 madeQueryBus.subscriptionQuery(SubscriptionQueryMessage)
,
QueryBus.subscriptionQuery(SubscriptionQueryMessage, SubscriptionQueryBackpressure, int)
public <Q,I,U> SubscriptionQueryResult<I,U> subscriptionQuery(String queryName, Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType, int updateBufferSize)
QueryGateway
query
over the QueryBus
and 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 null
results, on the initial result or the updates, wil lbe filtered out by the
QueryGateway. If you require the null
to be returned for the initial and update results, we suggest using
the QueryBus
instead.
subscriptionQuery
in interface QueryGateway
Q
- the type of the queryI
- the type of the initial responseU
- the type of the incremental updatequeryName
- a String
describing query to be executedquery
- the query
to 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 madeQueryBus.subscriptionQuery(SubscriptionQueryMessage)
,
QueryBus.subscriptionQuery(SubscriptionQueryMessage, int)
public Registration registerDispatchInterceptor(MessageDispatchInterceptor<? super QueryMessage<?,?>> interceptor)
MessageDispatchInterceptorSupport
registerDispatchInterceptor
in interface MessageDispatchInterceptorSupport<QueryMessage<?,?>>
interceptor
- The interceptor to registerCopyright © 2010–2022. All rights reserved.