/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response with * the given {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType A {@link java.lang.Class} describing the desired response type * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, Class<R> responseType) { return query(query.getClass().getName(), query, responseType); }
ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure) { return subscriptionQuery(queryName, query, initialResponseType,
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from several sources. The stream is completed when a {@code timeout} occurs or when * all results are received. The query name will be derived from the provided {@code query}. Execution may be * asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link ResponseType} used for this query * @param timeout A timeout of {@code long} for the query * @param timeUnit The selected {@link java.util.concurrent.TimeUnit} for the given {@code timeout} * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A stream of results. */ default <R, Q> Stream<R> scatterGather(Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit) { return scatterGather(query.getClass().getName(), query, responseType, timeout, timeUnit); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link ResponseType} used for this query * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, ResponseType<R> responseType) { return query(query.getClass().getName(), query, responseType); }
/** * Sends given {@code query} over the {@link 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). * <p> * <b>Note</b>: Any {@code null} results, on the initial result or the updates, wil lbe filtered out by the * QueryGateway. If you require the {@code null} to be returned for the initial and update results, we suggest using * the {@link QueryBus} instead. * * @param query The {@code query} to be sent * @param initialResponseType The initial response type used for this query * @param updateResponseType The update response type used for this query * @param <Q> The type of the query * @param <I> The type of the initial response * @param <U> The type of the incremental update * @return registration which can be used to cancel receiving updates * * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage) * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage, SubscriptionQueryBackpressure, int) */ default <Q, I, U> SubscriptionQueryResult<I, U> subscriptionQuery(Q query, Class<I> initialResponseType, Class<U> updateResponseType) { return subscriptionQuery(query.getClass().getName(), query, initialResponseType, updateResponseType); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from several sources. The stream is completed when a {@code timeout} occurs or when * all results are received. The query name will be derived from the provided {@code query}. Execution may be * asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link org.axonframework.queryhandling.responsetypes.ResponseType} used for this query * @param timeout A timeout of {@code long} for the query * @param timeUnit The selected {@link java.util.concurrent.TimeUnit} for the given {@code timeout} * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A stream of results. */ default <R, Q> Stream<R> scatterGather(Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit) { return scatterGather(query.getClass().getName(), query, responseType, timeout, timeUnit); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response with * the given {@code responseType} from a single source. Execution may be asynchronous, depending on the QueryBus * implementation. * * @param queryName A {@link java.lang.String} describing the query to be executed * @param query The {@code query} to be sent * @param responseType The {@link ResponseType} used for this query * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(String queryName, Q query, Class<R> responseType) { return query(queryName, query, ResponseTypes.instanceOf(responseType)); }
/** * Sends given {@code query} over the {@link 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). * <p> * <b>Note</b>: Any {@code null} results, on the initial result or the updates, wil lbe filtered out by the * QueryGateway. If you require the {@code null} to be returned for the initial and update results, we suggest using * the {@link QueryBus} instead. * * @param query The {@code query} to be sent * @param initialResponseType The initial response type used for this query * @param updateResponseType The update response type used for this query * @param <Q> The type of the query * @param <I> The type of the initial response * @param <U> The type of the incremental update * @return registration which can be used to cancel receiving updates * * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage) * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage, SubscriptionQueryBackpressure, int) */ default <Q, I, U> SubscriptionQueryResult<I, U> subscriptionQuery(Q query, ResponseType<I> initialResponseType, ResponseType<U> updateResponseType) { return subscriptionQuery(query.getClass().getName(), query, initialResponseType, updateResponseType, SubscriptionQueryBackpressure.defaultBackpressure()); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from several sources. The stream is completed when a {@code timeout} occurs or when * all results are received. The query name will be derived from the provided {@code query}. Execution may be * asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link ResponseType} used for this query * @param timeout A timeout of {@code long} for the query * @param timeUnit The selected {@link java.util.concurrent.TimeUnit} for the given {@code timeout} * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A stream of results. */ default <R, Q> Stream<R> scatterGather(Q query, ResponseType<R> responseType, long timeout, TimeUnit timeUnit) { return scatterGather(query.getClass().getName(), query, responseType, timeout, timeUnit); }
/** * Sends given query to the query bus and expects a result of type resultClass. Execution may be asynchronous. * * @param query The query. * @param queryName The name of the query. * @param responseType The expected result type. * @param <R> The type of result expected from query execution. * @param <Q> The query class. * @return A completable future that contains the first result of the query.. * * @throws NullPointerException when query is null. * @deprecated Use {@link #query(String, Object, Class)} instead. */ @Deprecated default <R, Q> CompletableFuture<R> send(String queryName, Q query, Class<R> responseType) { return query(queryName, query, responseType); }
/** * Sends given {@code query} over the {@link 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). * <p> * <b>Note</b>: Any {@code null} results, on the initial result or the updates, wil lbe filtered out by the * QueryGateway. If you require the {@code null} to be returned for the initial and update results, we suggest using * the {@link QueryBus} instead. * * @param queryName A {@link String} describing query to be executed * @param query The {@code query} to be sent * @param initialResponseType The initial response type used for this query * @param updateResponseType The update response type used for this query * @param <Q> The type of the query * @param <I> The type of the initial response * @param <U> The type of the incremental update * @return registration which can be used to cancel receiving updates * * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage) * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage, SubscriptionQueryBackpressure, int) */ default <Q, I, U> SubscriptionQueryResult<I, U> subscriptionQuery(String queryName, Q query, Class<I> initialResponseType, Class<U> updateResponseType) { return subscriptionQuery(queryName, query, ResponseTypes.instanceOf(initialResponseType), ResponseTypes.instanceOf(updateResponseType), SubscriptionQueryBackpressure.defaultBackpressure()); }
/** * Sends given query to the query bus and expects a stream of results with type responseType. The stream is * completed when a timeout occurs or when all results are received. * * @param query The query. * @param responseType The expected result type. * @param timeout Timeout for the request. * @param timeUnit Unit for the timeout. * @param <R> The type of result expected from query execution. * @param <Q> The query class. * @return A stream of results. * * @throws NullPointerException when query is null. * @deprecated Use {@link #scatterGather(Object, ResponseType, long, TimeUnit)} instead. */ @Deprecated default <R, Q> Stream<R> send(Q query, Class<R> responseType, long timeout, TimeUnit timeUnit) { return scatterGather(query, ResponseTypes.instanceOf(responseType), timeout, timeUnit); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response with * the given {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType A {@link java.lang.Class} describing the desired response type * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, Class<R> responseType) { return query(query.getClass().getName(), query, responseType); }
ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure) { return subscriptionQuery(queryName, query, initialResponseType,
/** * Sends given query to the query bus and expects a stream of results with name resultName. The stream is completed * when a timeout occurs or when all results are received. * * @param query The query. * @param queryName The name of the query. * @param resultClass Type type of result. * @param timeout Timeout for the request. * @param timeUnit Unit for the timeout. * @param <R> The type of result expected from query execution. * @param <Q> The query class. * @return A stream of results. * * @deprecated Use {@link #scatterGather(String, Object, ResponseType, long, TimeUnit)} instead. */ @Deprecated default <R, Q> Stream<R> send(Q query, String queryName, Class<R> resultClass, long timeout, TimeUnit timeUnit) { return scatterGather(queryName, query, ResponseTypes.instanceOf(resultClass), timeout, timeUnit); } }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link org.axonframework.queryhandling.responsetypes.ResponseType} used for this query * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, ResponseType<R> responseType) { return query(query.getClass().getName(), query, responseType); }
ResponseType<U> updateResponseType, SubscriptionQueryBackpressure backpressure) { return subscriptionQuery(queryName, query, initialResponseType,
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response in the * form of {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType The {@link ResponseType} used for this query * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, ResponseType<R> responseType) { return query(query.getClass().getName(), query, responseType); }
/** * Sends given {@code query} over the {@link 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). * <p> * <b>Note</b>: Any {@code null} results, on the initial result or the updates, wil lbe filtered out by the * QueryGateway. If you require the {@code null} to be returned for the initial and update results, we suggest using * the {@link QueryBus} instead. * * @param query The {@code query} to be sent * @param initialResponseType The initial response type used for this query * @param updateResponseType The update response type used for this query * @param <Q> The type of the query * @param <I> The type of the initial response * @param <U> The type of the incremental update * @return registration which can be used to cancel receiving updates * * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage) * @see QueryBus#subscriptionQuery(SubscriptionQueryMessage, SubscriptionQueryBackpressure, int) */ default <Q, I, U> SubscriptionQueryResult<I, U> subscriptionQuery(Q query, Class<I> initialResponseType, Class<U> updateResponseType) { return subscriptionQuery(query.getClass().getName(), query, initialResponseType, updateResponseType); }
/** * Sends given {@code query} over the {@link org.axonframework.queryhandling.QueryBus}, expecting a response with * the given {@code responseType} from a single source. The query name will be derived from the provided * {@code query}. Execution may be asynchronous, depending on the QueryBus implementation. * * @param query The {@code query} to be sent * @param responseType A {@link java.lang.Class} describing the desired response type * @param <R> The response class contained in the given {@code responseType} * @param <Q> The query class * @return A {@link java.util.concurrent.CompletableFuture} containing the query result as dictated by the given * {@code responseType} */ default <R, Q> CompletableFuture<R> query(Q query, Class<R> responseType) { return query(query.getClass().getName(), query, responseType); }