Package org.axonframework.queryhandling
Class SimpleQueryUpdateEmitter
java.lang.Object
org.axonframework.queryhandling.SimpleQueryUpdateEmitter
- All Implemented Interfaces:
MessageDispatchInterceptorSupport<SubscriptionQueryUpdateMessage<?>>,QueryUpdateEmitter
Implementation of
QueryUpdateEmitter that uses Project Reactor to implement Update Handlers.- Since:
- 4.0
- Author:
- Milan Savic, Stefan Dragisic
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aSimpleQueryUpdateEmitter. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aSimpleQueryUpdateEmitterbased on the fields contained in theSimpleQueryUpdateEmitter.Builder. -
Method Summary
Modifier and TypeMethodDescriptionSet<SubscriptionQueryMessage<?, ?, ?>> Provides the set of running subscription queries.builder()Instantiate a Builder to be able to create aSimpleQueryUpdateEmitter.voidcomplete(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter) Completes subscription queries matching given filter.voidcompleteExceptionally(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, Throwable cause) Completes with an error subscription queries matching given 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.booleanqueryUpdateHandlerRegistered(SubscriptionQueryMessage<?, ?, ?> query) Checks whether there is a query update handler for a givenquery.registerDispatchInterceptor(MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage<?>> interceptor) Register the given DispatchInterceptor.<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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.queryhandling.QueryUpdateEmitter
complete, completeExceptionally, emit, emit, emit
-
Constructor Details
-
SimpleQueryUpdateEmitter
Instantiate aSimpleQueryUpdateEmitterbased on the fields contained in theSimpleQueryUpdateEmitter.Builder.- Parameters:
builder- theSimpleQueryUpdateEmitter.Builderused to instantiate aSimpleQueryUpdateEmitterinstance
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aSimpleQueryUpdateEmitter.The
MessageMonitoris defaulted to aNoOpMessageMonitorand theQueryBusSpanFactorydefaults to aDefaultQueryBusSpanFactorybacked by aNoOpSpanFactory.- Returns:
- a Builder to be able to create a
SimpleQueryUpdateEmitter
-
queryUpdateHandlerRegistered
Description copied from interface:QueryUpdateEmitterChecks whether there is a query update handler for a givenquery.- Specified by:
queryUpdateHandlerRegisteredin interfaceQueryUpdateEmitter- 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 public <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.- Specified by:
registerUpdateHandlerin interfaceQueryUpdateEmitter- 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
public <U> UpdateHandlerRegistration<U> registerUpdateHandler(@Nonnull SubscriptionQueryMessage<?, ?, ?> query, int updateBufferSize) Description copied from interface:QueryUpdateEmitterRegisters an Update Handler for givenquerywith givenupdateBufferSize.- Specified by:
registerUpdateHandlerin interfaceQueryUpdateEmitter- 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
-
emit
public <U> void emit(@Nonnull Predicate<SubscriptionQueryMessage<?, ?, U>> filter, @Nonnull SubscriptionQueryUpdateMessage<U> update) Description copied from interface:QueryUpdateEmitterEmits incremental update (as return value of provided update function) to subscription queries matching given filter.- Specified by:
emitin interfaceQueryUpdateEmitter- Type Parameters:
U- the type of the update- Parameters:
filter- predicate on subscription query message used to filter subscription queriesupdate- incremental update message
-
complete
Description copied from interface:QueryUpdateEmitterCompletes subscription queries matching given filter.- Specified by:
completein interfaceQueryUpdateEmitter- Parameters:
filter- predicate on subscription query message used to filter subscription queries
-
completeExceptionally
public void completeExceptionally(@Nonnull Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, @Nonnull Throwable cause) Description copied from interface:QueryUpdateEmitterCompletes with an error subscription queries matching given filter.- Specified by:
completeExceptionallyin interfaceQueryUpdateEmitter- Parameters:
filter- predicate on subscription query message used to filter subscription queriescause- the cause of an error
-
registerDispatchInterceptor
@Nonnull public Registration registerDispatchInterceptor(@Nonnull MessageDispatchInterceptor<? super SubscriptionQueryUpdateMessage<?>> interceptor) Description copied from interface:MessageDispatchInterceptorSupportRegister the given DispatchInterceptor. After registration, the interceptor will be invoked for each Message dispatched on the messaging component that it was registered to.- Specified by:
registerDispatchInterceptorin interfaceMessageDispatchInterceptorSupport<SubscriptionQueryUpdateMessage<?>>- Parameters:
interceptor- The interceptor to register- Returns:
- A Registration, which may be used to deregister the interceptor.
-
activeSubscriptions
Description copied from interface:QueryUpdateEmitterProvides 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.- Specified by:
activeSubscriptionsin interfaceQueryUpdateEmitter- Returns:
- the set of running subscription queries
-
registerUpdateHandler(SubscriptionQueryMessage, int)}