Interface QueryUpdateEmitter
- All Superinterfaces:
DescribableComponent
- All Known Implementing Classes:
SimpleQueryUpdateEmitter
Query-specific component that interacts with
subscription queries about
update, errors,
and when there are no more update.
Implementations of the QueryUpdateEmitter are expected to be context-aware, to
ensure operations occur within the correct order of (for example) the lifecycle of an
event handling function.
- Since:
- 3.3.0
- Author:
- Milan Savic, Steven van Beelen
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<Q> voidCompletes subscription queries matching the givenqueryTypeandfilter.voidcomplete(QualifiedName queryName, Predicate<Object> filter) Completes subscription queries matching the givenqueryNameandfilter.<Q> voidcompleteExceptionally(Class<Q> queryType, Predicate<? super Q> filter, Throwable cause) Completes subscription queries with the givencausematching givenqueryTypeandfilter.voidcompleteExceptionally(QualifiedName queryName, Predicate<Object> filter, Throwable cause) Completes subscription queries with the givencausematching givenqueryNameandfilter.default <Q> voidEmits givenupdateto subscription queries matching the givenqueryTypeand givenfilter.<Q> voidEmits the outcome of theupdateSupplierto subscription queries matching the givenqueryTypeand givenfilter.default voidemit(QualifiedName queryName, Predicate<Object> filter, Object update) Emits givenupdateto subscription queries matching the givenqueryNameand givenfilter.voidEmits the outcome of theupdateSupplierto subscription queries matching the givenqueryNameand givenfilter.static QueryUpdateEmitterforContext(ProcessingContext context) Creates a query update emitter for the givenProcessingContext.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Field Details
-
RESOURCE_KEY
-
-
Method Details
-
forContext
Creates a query update emitter for the givenProcessingContext.You can use this emitter only for the context it was created for. There is no harm in using this method more than once with the same
context, as the same emitter will be returned.- Parameters:
context- TheProcessingContextto create the emitter for.- Returns:
- The emitter specific for the given
context.
-
emit
default <Q> void emit(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nullable Object update) Emits givenupdateto subscription queries matching the givenqueryTypeand givenfilter.- Type Parameters:
Q- The type of theto filter on.invalid reference
SubscriptionQueryMessage- Parameters:
queryType- The type of theto filter on.invalid reference
SubscriptionQueryMessagefilter- A predicate testing the, converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.update- The incremental update to emit forsubscription queriesmatching the givenfilter.- Throws:
MessageTypeNotResolvedException- If the givenqueryTypehas no knownMessageTypeequivalent required to filter the.invalid reference
SubscriptionQueryMessage#payload()ConversionException- If thecould not be converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto perform the givenfilter. Will only occur if aMessageTypecould be found for the givenqueryType.
-
emit
<Q> void emit(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nonnull Supplier<Object> updateSupplier) Emits the outcome of theupdateSupplierto subscription queries matching the givenqueryTypeand givenfilter.The
updateSupplieris only invoked whenever there are matching queries.- Type Parameters:
Q- The type of theto filter on.invalid reference
SubscriptionQueryMessage- Parameters:
queryType- The type of theto filter on.invalid reference
SubscriptionQueryMessagefilter- A predicate testing the, converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.updateSupplier- The update supplier to emit forsubscription queriesmatching the givenqueryTypeandfilter.- Throws:
MessageTypeNotResolvedException- If the givenqueryTypehas no knownMessageTypeequivalent required to filter the.invalid reference
SubscriptionQueryMessage#payload()ConversionException- If thecould not be converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto perform the givenfilter. Will only occur if aMessageTypecould be found for the givenqueryType.
-
emit
default void emit(@Nonnull QualifiedName queryName, @Nonnull Predicate<Object> filter, @Nullable Object update) Emits givenupdateto subscription queries matching the givenqueryNameand givenfilter.- Parameters:
queryName- The qualified name of theto filter on.invalid reference
SubscriptionQueryMessage#type()filter- A predicate testing theas is to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.update- The incremental update to emit forsubscription queriesmatching the givenfilter.
-
emit
void emit(@Nonnull QualifiedName queryName, @Nonnull Predicate<Object> filter, @Nonnull Supplier<Object> updateSupplier) Emits the outcome of theupdateSupplierto subscription queries matching the givenqueryNameand givenfilter.The
updateSupplieris only invoked whenever there are matching queries.- Parameters:
queryName- The qualified name of theto filter on.invalid reference
SubscriptionQueryMessage#type()filter- A predicate testing theas is to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.updateSupplier- The update supplier to emit forsubscription queriesmatching the givenqueryNameandfilter.
-
complete
Completes subscription queries matching the givenqueryTypeandfilter.- Type Parameters:
Q- The type of theto filter on.invalid reference
SubscriptionQueryMessage- Parameters:
queryType- The type of theto filter on.invalid reference
SubscriptionQueryMessagefilter- A predicate testing the, converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.- Throws:
MessageTypeNotResolvedException- If the givenqueryTypehas no knownMessageTypeequivalent required to filter the.invalid reference
SubscriptionQueryMessage#payload()ConversionException- If thecould not be converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto perform the givenfilter. Will only occur if aMessageTypecould be found for the givenqueryType.
-
complete
Completes subscription queries matching the givenqueryNameandfilter.- Parameters:
queryName- The qualified name of theto filter on.invalid reference
SubscriptionQueryMessage#type()filter- A predicate testing theas is to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.
-
completeExceptionally
<Q> void completeExceptionally(@Nonnull Class<Q> queryType, @Nonnull Predicate<? super Q> filter, @Nonnull Throwable cause) Completes subscription queries with the givencausematching givenqueryTypeandfilter.- Type Parameters:
Q- The type of theto filter on.invalid reference
SubscriptionQueryMessage- Parameters:
queryType- The type of theto filter on.invalid reference
SubscriptionQueryMessagefilter- A predicate testing the, converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.cause- The cause of an error leading to exceptionally complete subscription queries.- Throws:
MessageTypeNotResolvedException- If the givenqueryTypehas no knownMessageTypeequivalent required to filter the.invalid reference
SubscriptionQueryMessage#payload()ConversionException- If thecould not be converted to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto perform the givenfilter. Will only occur if aMessageTypecould be found for the givenqueryType.
-
completeExceptionally
void completeExceptionally(@Nonnull QualifiedName queryName, @Nonnull Predicate<Object> filter, @Nonnull Throwable cause) Completes subscription queries with the givencausematching givenqueryNameandfilter.- Parameters:
queryName- The qualified name of theto filter on.invalid reference
SubscriptionQueryMessage#type()filter- A predicate testing theas is to the giveninvalid reference
SubscriptionQueryMessage#payload()queryTypeto filter on.cause- The cause of an error leading to exceptionally complete subscription queries.
-