Package org.axonframework.queryhandling
Interface QueryUpdateEmitter
- All Superinterfaces:
MessageDispatchInterceptorSupport<SubscriptionQueryUpdateMessage<?>>
- All Known Implementing Classes:
SimpleQueryUpdateEmitter
public interface QueryUpdateEmitter
extends MessageDispatchInterceptorSupport<SubscriptionQueryUpdateMessage<?>>
Component which informs subscription queries about updates, errors and when there are no more updates.
If any of the emitter functions in this interface are called from a message handling function (e.g. an EventHandler annotated function), then that call will automatically be tied into the
lifecycle of the current UnitOfWork to ensure correct order of
execution.
Added, implementations of this class should thus respect any current UnitOfWork in the UnitOfWork.Phase.STARTED phase for any of the emitting functions. If this is
the case then the emitter call action should be performed during the UnitOfWork.Phase.AFTER_COMMIT.
Otherwise the operation can be executed immediately.
- Since:
- 3.3
- Author:
- Milan Savic
-
Method Summary
Modifier and TypeMethodDescriptiondefault Set<SubscriptionQueryMessage<?, ?, ?>> Provides the set of running subscription queries.default <Q> voidCompletes subscription queries matching given query type and filter.voidcomplete(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter) Completes subscription queries matching given filter.default <Q> voidcompleteExceptionally(Class<Q> queryType, Predicate<? super Q> filter, Throwable cause) Completes with an error subscription queries matching given query type and filtervoidcompleteExceptionally(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, Throwable cause) Completes with an error subscription queries matching given filter.default <Q,U> void emit(Class<Q> queryType, Predicate<? super Q> filter, SubscriptionQueryUpdateMessage<U> update) Emits given incremental update to subscription queries matching given query type and filter.default <Q,U> void Emits given incremental update to subscription queries matching given query type and filter.<U> voidemit(Predicate<SubscriptionQueryMessage<?, ?, U>> filter, SubscriptionQueryUpdateMessage<U> update) Emits incremental update (as return value of provided update function) to subscription queries matching given filter.default <U> voidemit(Predicate<SubscriptionQueryMessage<?, ?, U>> filter, U update) Emits given incremental update to subscription queries matching given filter.booleanqueryUpdateHandlerRegistered(SubscriptionQueryMessage<?, ?, ?> query) Checks whether there is a query update handler for a givenquery.<U> UpdateHandlerRegistration<U> registerUpdateHandler(SubscriptionQueryMessage<?, ?, ?> query, int updateBufferSize) Registers an Update Handler for givenquerywith givenupdateBufferSize.<U> UpdateHandlerRegistration<U> registerUpdateHandler(SubscriptionQueryMessage<?, ?, ?> query, SubscriptionQueryBackpressure backpressure, int updateBufferSize) Deprecated.Methods inherited from interface org.axonframework.messaging.MessageDispatchInterceptorSupport
registerDispatchInterceptor
-
Method Details
-
emit
<U> void emit(@Nonnull Predicate<SubscriptionQueryMessage<?, ?, U>> filter, @Nonnull SubscriptionQueryUpdateMessage<U> update) Emits incremental update (as return value of provided update function) to subscription queries matching given filter.- Type Parameters:
U- the type of the update- Parameters:
filter- predicate on subscription query message used to filter subscription queriesupdate- incremental update message
-
emit
default <U> void emit(@Nonnull Predicate<SubscriptionQueryMessage<?, ?, U>> filter, @Nullable U update) Emits given incremental update to subscription queries matching given filter. If anupdateisnull, emit will be skipped. In order to send nullable updates, useemit(Class, Predicate, SubscriptionQueryUpdateMessage)oremit(Predicate, SubscriptionQueryUpdateMessage)methods.- Type Parameters:
U- the type of the update- Parameters:
filter- predicate on subscription query message used to filter subscription queriesupdate- incremental update
-
emit
default <Q,U> void emit(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nonnull SubscriptionQueryUpdateMessage<U> update) Emits given incremental update to subscription queries matching given query type and filter.- Type Parameters:
Q- the type of the queryU- the type of the update- Parameters:
queryType- the type of the queryfilter- predicate on query payload used to filter subscription queriesupdate- incremental update message
-
emit
default <Q,U> void emit(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nullable U update) Emits given incremental update to subscription queries matching given query type and filter. If anupdateisnull, emit will be skipped. In order to send nullable updates, useemit(Class, Predicate, SubscriptionQueryUpdateMessage)oremit(Predicate, SubscriptionQueryUpdateMessage)methods.- Type Parameters:
Q- the type of the queryU- the type of the update- Parameters:
queryType- the type of the queryfilter- predicate on query payload used to filter subscription queriesupdate- incremental update
-
complete
Completes subscription queries matching given filter.- Parameters:
filter- predicate on subscription query message used to filter subscription queries
-
complete
Completes subscription queries matching given query type and filter.- Type Parameters:
Q- the type of the query- Parameters:
queryType- the type of the queryfilter- predicate on query payload used to filter subscription queries
-
completeExceptionally
void completeExceptionally(@Nonnull Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, @Nonnull Throwable cause) Completes with an error subscription queries matching given filter.- Parameters:
filter- predicate on subscription query message used to filter subscription queriescause- the cause of an error
-
completeExceptionally
default <Q> void completeExceptionally(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nonnull Throwable cause) Completes with an error subscription queries matching given query type and filter- Type Parameters:
Q- the type of the query- Parameters:
queryType- the type of the queryfilter- predicate on query payload used to filter subscription queriescause- the cause of an error
-
queryUpdateHandlerRegistered
Checks whether there is a query update handler for a givenquery.- Parameters:
query- the subscription query for which we have registered the update handler- Returns:
trueif there is an update handler registered for givenquery,falseotherwise
-
registerUpdateHandler
@Deprecated <U> UpdateHandlerRegistration<U> registerUpdateHandler(SubscriptionQueryMessage<?, ?, ?> query, SubscriptionQueryBackpressure backpressure, int updateBufferSize) Deprecated.in favour of using {registerUpdateHandler(SubscriptionQueryMessage, int)}Registers an Update Handler for givenquerywith givenbackpressureandupdateBufferSize.- Type Parameters:
U- the incremental response types of the query- Parameters:
query- the subscription query for which we register an Update Handlerbackpressure- the backpressure mechanism to be used for emitting updatesupdateBufferSize- the size of buffer which accumulates updates before subscription to thefluxis made- Returns:
- the object which contains updates and a registration which can be used to cancel them
-
registerUpdateHandler
<U> UpdateHandlerRegistration<U> registerUpdateHandler(@Nonnull SubscriptionQueryMessage<?, ?, ?> query, int updateBufferSize) Registers an Update Handler for givenquerywith givenupdateBufferSize.- Type Parameters:
U- the incremental response types of the query- Parameters:
query- the subscription query for which we register an Update HandlerupdateBufferSize- the size of buffer which accumulates updates before subscription to thefluxis made- Returns:
- the object which contains updates and a registration which can be used to cancel them
-
activeSubscriptions
Provides the set of running subscription queries. If there are changes to subscriptions they will be reflected in the returned set of this method. Implementations should provide an unmodifiable set of the active subscriptions.- Returns:
- the set of running subscription queries
-
registerUpdateHandler(SubscriptionQueryMessage, int)}