public class DefaultQueryGateway extends Object implements QueryGateway
Constructor and Description |
---|
DefaultQueryGateway(QueryBus queryBus,
MessageDispatchInterceptor<? super QueryMessage<?,?>>... dispatchInterceptors)
Initializes the gateway to send queries to the given
queryBus and invoking given
dispatchInterceptors prior to publication ont he query bus. |
Modifier and Type | Method and Description |
---|---|
<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. |
<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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
query, query, query, scatterGather, send, send, send, send
@SafeVarargs public DefaultQueryGateway(QueryBus queryBus, MessageDispatchInterceptor<? super QueryMessage<?,?>>... dispatchInterceptors)
queryBus
and invoking given
dispatchInterceptors
prior to publication ont he query bus.queryBus
- The bus to deliver messages ondispatchInterceptors
- The interceptors to invoke prior to publication on the buspublic <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
Copyright © 2010–2018. All rights reserved.