public class AxonServerQueryBus extends Object implements org.axonframework.queryhandling.QueryBus, org.axonframework.messaging.Distributed<org.axonframework.queryhandling.QueryBus>, org.axonframework.lifecycle.Lifecycle
QueryBus implementation that connects to Axon Server to submit and receive queries and query responses.
Delegates incoming queries to the provided localSegment.| Modifier and Type | Class and Description |
|---|---|
static class |
AxonServerQueryBus.Builder
Builder class to instantiate an
AxonServerQueryBus. |
| Constructor and Description |
|---|
AxonServerQueryBus(AxonServerQueryBus.Builder builder)
Instantiate a
AxonServerQueryBus based on the fields contained in the AxonServerQueryBus.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static AxonServerQueryBus.Builder |
builder()
Instantiate a Builder to be able to create an
AxonServerQueryBus. |
void |
disconnect()
Disconnect the query bus from Axon Server, by unsubscribing all known query handlers.
|
org.axonframework.queryhandling.QueryBus |
localSegment() |
<Q,R> CompletableFuture<org.axonframework.queryhandling.QueryResponseMessage<R>> |
query(org.axonframework.queryhandling.QueryMessage<Q,R> queryMessage) |
org.axonframework.queryhandling.QueryUpdateEmitter |
queryUpdateEmitter() |
org.axonframework.common.Registration |
registerDispatchInterceptor(org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.queryhandling.QueryMessage<?,?>> dispatchInterceptor) |
org.axonframework.common.Registration |
registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.queryhandling.QueryMessage<?,?>> interceptor) |
void |
registerLifecycleHandlers(org.axonframework.lifecycle.Lifecycle.LifecycleRegistry lifecycle) |
<Q,R> Stream<org.axonframework.queryhandling.QueryResponseMessage<R>> |
scatterGather(org.axonframework.queryhandling.QueryMessage<Q,R> queryMessage,
long timeout,
TimeUnit timeUnit) |
CompletableFuture<Void> |
shutdownDispatching()
Shutdown the query bus asynchronously for dispatching queries to Axon Server.
|
void |
start()
Start the Axon Server
QueryBus implementation. |
<Q,R> org.reactivestreams.Publisher<org.axonframework.queryhandling.QueryResponseMessage<R>> |
streamingQuery(org.axonframework.queryhandling.StreamingQueryMessage<Q,R> query) |
<R> org.axonframework.common.Registration |
subscribe(String queryName,
Type responseType,
org.axonframework.messaging.MessageHandler<? super org.axonframework.queryhandling.QueryMessage<?,R>> handler) |
<Q,I,U> org.axonframework.queryhandling.SubscriptionQueryResult<org.axonframework.queryhandling.QueryResponseMessage<I>,org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U>> |
subscriptionQuery(org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U> query,
int updateBufferSize) |
<Q,I,U> org.axonframework.queryhandling.SubscriptionQueryResult<org.axonframework.queryhandling.QueryResponseMessage<I>,org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U>> |
subscriptionQuery(org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U> query,
org.axonframework.queryhandling.SubscriptionQueryBackpressure backPressure,
int updateBufferSize)
Deprecated.
in favor of using the {
subscriptionQuery(SubscriptionQueryMessage, int)} |
public AxonServerQueryBus(AxonServerQueryBus.Builder builder)
AxonServerQueryBus based on the fields contained in the AxonServerQueryBus.Builder.builder - the AxonServerQueryBus.Builder used to instantiate a AxonServerQueryBus instancepublic <Q,R> org.reactivestreams.Publisher<org.axonframework.queryhandling.QueryResponseMessage<R>> streamingQuery(org.axonframework.queryhandling.StreamingQueryMessage<Q,R> query)
streamingQuery in interface org.axonframework.queryhandling.QueryBuspublic static AxonServerQueryBus.Builder builder()
AxonServerQueryBus.
The QueryPriorityCalculator is defaulted to
QueryPriorityCalculator.defaultQueryPriorityCalculator(), the TargetContextResolver defaults to a
lambda returning the AxonServerConfiguration.getContext() as the context, the
ExecutorServiceBuilder defaults to ExecutorServiceBuilder.defaultQueryExecutorServiceBuilder().
The AxonServerConnectionManager and the QueryBusSpanFactory defaults to a
DefaultQueryBusSpanFactory backed by a NoOpSpanFactory. The AxonServerConfiguration, the
local QueryBus, the QueryUpdateEmitter, and the message and generic Serializers are
hard requirements and as such should be provided.
AxonServerQueryBuspublic void registerLifecycleHandlers(@Nonnull org.axonframework.lifecycle.Lifecycle.LifecycleRegistry lifecycle)
registerLifecycleHandlers in interface org.axonframework.lifecycle.Lifecyclepublic void start()
QueryBus implementation.public <R> org.axonframework.common.Registration subscribe(@Nonnull String queryName, @Nonnull Type responseType, @Nonnull org.axonframework.messaging.MessageHandler<? super org.axonframework.queryhandling.QueryMessage<?,R>> handler)
subscribe in interface org.axonframework.queryhandling.QueryBuspublic <Q,R> CompletableFuture<org.axonframework.queryhandling.QueryResponseMessage<R>> query(@Nonnull org.axonframework.queryhandling.QueryMessage<Q,R> queryMessage)
query in interface org.axonframework.queryhandling.QueryBuspublic <Q,R> Stream<org.axonframework.queryhandling.QueryResponseMessage<R>> scatterGather(@Nonnull org.axonframework.queryhandling.QueryMessage<Q,R> queryMessage, long timeout, @Nonnull TimeUnit timeUnit)
scatterGather in interface org.axonframework.queryhandling.QueryBus@Deprecated public <Q,I,U> org.axonframework.queryhandling.SubscriptionQueryResult<org.axonframework.queryhandling.QueryResponseMessage<I>,org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U>> subscriptionQuery(@Nonnull org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U> query, org.axonframework.queryhandling.SubscriptionQueryBackpressure backPressure, int updateBufferSize)
subscriptionQuery(SubscriptionQueryMessage, int)}subscriptionQuery in interface org.axonframework.queryhandling.QueryBuspublic <Q,I,U> org.axonframework.queryhandling.SubscriptionQueryResult<org.axonframework.queryhandling.QueryResponseMessage<I>,org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U>> subscriptionQuery(@Nonnull org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U> query, int updateBufferSize)
subscriptionQuery in interface org.axonframework.queryhandling.QueryBuspublic org.axonframework.queryhandling.QueryUpdateEmitter queryUpdateEmitter()
queryUpdateEmitter in interface org.axonframework.queryhandling.QueryBuspublic org.axonframework.queryhandling.QueryBus localSegment()
localSegment in interface org.axonframework.messaging.Distributed<org.axonframework.queryhandling.QueryBus>public org.axonframework.common.Registration registerHandlerInterceptor(@Nonnull org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.queryhandling.QueryMessage<?,?>> interceptor)
registerHandlerInterceptor in interface org.axonframework.messaging.MessageHandlerInterceptorSupport<org.axonframework.queryhandling.QueryMessage<?,?>>@Nonnull public org.axonframework.common.Registration registerDispatchInterceptor(@Nonnull org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.queryhandling.QueryMessage<?,?>> dispatchInterceptor)
registerDispatchInterceptor in interface org.axonframework.messaging.MessageDispatchInterceptorSupport<org.axonframework.queryhandling.QueryMessage<?,?>>public void disconnect()
Phase.INBOUND_QUERY_CONNECTOR phase.public CompletableFuture<Void> shutdownDispatching()
Phase.OUTBOUND_QUERY_CONNECTORS phase.Copyright © 2010–2024. All rights reserved.