/** * 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()); }
/** * Dispatch the given {@code query} to a single QueryHandler subscribed to the given {@code query}'s * queryName/initialResponseType/updateResponseType. The result is lazily created and there will be no execution of * the query handler before there is a subscription to the initial result. In order not to miss updates, the query * bus will queue all updates which happen after the subscription query is done and once the subscription to the * flux is made, these updates will be emitted. * <p> * If there is an error during retrieving or consuming initial result, stream for incremental updates is NOT * interrupted. * </p> * <p> * If there is an error during emitting an update, subscription is cancelled causing further emits not reaching the * destination. * </p> * <p> * Backpressure mechanism to be used is {@link SubscriptionQueryBackpressure#defaultBackpressure()}. The size of * buffer which accumulates the updates (not to be missed) is {@link Queues#SMALL_BUFFER_SIZE}. * </p> * * @param query the query * @param <Q> the payload type of the query * @param <I> the response type of the query * @param <U> the incremental response types of the query * @return query result containing initial result and incremental updates */ default <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query) { return subscriptionQuery(query, SubscriptionQueryBackpressure.defaultBackpressure(), Queues.SMALL_BUFFER_SIZE); }
/** * 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 {@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 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()); }
/** * Dispatch the given {@code query} to a single QueryHandler subscribed to the given {@code query}'s * queryName/initialResponseType/updateResponseType. The result is lazily created and there will be no execution of * the query handler before there is a subscription to the initial result. In order not to miss updates, the query * bus will queue all updates which happen after the subscription query is done and once the subscription to the * flux is made, these updates will be emitted. * <p> * If there is an error during retrieving or consuming initial result, stream for incremental updates is NOT * interrupted. * </p> * <p> * If there is an error during emitting an update, subscription is cancelled causing further emits not reaching the * destination. * </p> * <p> * Backpressure mechanism to be used is {@link SubscriptionQueryBackpressure#defaultBackpressure()}. The size of * buffer which accumulates the updates (not to be missed) is {@link Queues#SMALL_BUFFER_SIZE}. * </p> * * @param query the query * @param <Q> the payload type of the query * @param <I> the response type of the query * @param <U> the incremental response types of the query * @return query result containing initial result and incremental updates */ default <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query) { return subscriptionQuery(query, SubscriptionQueryBackpressure.defaultBackpressure(), Queues.SMALL_BUFFER_SIZE); }
/** * Dispatch the given {@code query} to a single QueryHandler subscribed to the given {@code query}'s * queryName/initialResponseType/updateResponseType. The result is lazily created and there will be no execution of * the query handler before there is a subscription to the initial result. In order not to miss updates, the query * bus will queue all updates which happen after the subscription query is done and once the subscription to the * flux is made, these updates will be emitted. * <p> * If there is an error during retrieving or consuming initial result, stream for incremental updates is NOT * interrupted. * </p> * <p> * If there is an error during emitting an update, subscription is cancelled causing further emits not reaching the * destination. * </p> * <p> * Backpressure mechanism to be used is {@link SubscriptionQueryBackpressure#defaultBackpressure()}. The size of * buffer which accumulates the updates (not to be missed) is {@link Queues#SMALL_BUFFER_SIZE}. * </p> * * @param query the query * @param <Q> the payload type of the query * @param <I> the response type of the query * @param <U> the incremental response types of the query * @return query result containing initial result and incremental updates */ default <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query) { return subscriptionQuery(query, SubscriptionQueryBackpressure.defaultBackpressure(), Queues.SMALL_BUFFER_SIZE); }
/** * 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 {@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()); }