public class AxonServerConnectionManager extends Object implements Lifecycle, ConnectionManager
Channel
s per context and providing them as the means to dispatch/receive messages.Modifier and Type | Class and Description |
---|---|
static class |
AxonServerConnectionManager.Builder
Builder class to instantiate an
AxonServerConnectionManager . |
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry
Modifier | Constructor and Description |
---|---|
protected |
AxonServerConnectionManager(AxonServerConnectionManager.Builder builder,
io.axoniq.axonserver.connector.AxonServerConnectionFactory connectionFactory)
Instantiate a
AxonServerConnectionManager based on the fields contained in the AxonServerConnectionManager.Builder , using the
given connectionFactory to obtain connections to AxonServer. |
Modifier and Type | Method and Description |
---|---|
static AxonServerConnectionManager.Builder |
builder()
Instantiate a Builder to be able to create an
AxonServerConnectionManager . |
Map<String,Boolean> |
connections()
Return the connections this instances manages.
|
void |
disconnect()
Disconnects any active connections, forcing a new connection to be established when one is requested.
|
void |
disconnect(String context)
Disconnects any active connection for the given
context , forcing a new connection to be established when
one is requested. |
io.grpc.Channel |
getChannel()
Deprecated.
|
io.grpc.Channel |
getChannel(String context)
Deprecated.
|
io.axoniq.axonserver.connector.AxonServerConnection |
getConnection()
Retrieves the
AxonServerConnection used for the default context of this application. |
io.axoniq.axonserver.connector.AxonServerConnection |
getConnection(String context)
Retrieves the
AxonServerConnection used for the given context of this application. |
String |
getDefaultContext()
Returns the name of the default context of this application.
|
boolean |
isConnected(String context)
Returns
true if a gRPC channel for the specific context is opened between client and AxonServer. |
void |
registerLifecycleHandlers(Lifecycle.LifecycleRegistry lifecycle)
Registers the activities to be executed in the various phases of an application's lifecycle.
|
void |
shutdown()
Stops the Connection Manager, closing any active connections and preventing new connections from being created.
|
void |
start()
Starts the
AxonServerConnectionManager . |
protected AxonServerConnectionManager(AxonServerConnectionManager.Builder builder, io.axoniq.axonserver.connector.AxonServerConnectionFactory connectionFactory)
AxonServerConnectionManager
based on the fields contained in the AxonServerConnectionManager.Builder
, using the
given connectionFactory
to obtain connections to AxonServer.builder
- the AxonServerConnectionManager.Builder
used to instantiate a AxonServerConnectionManager
instanceconnectionFactory
- a configured instance of the AxonServerConnectionFactorypublic static AxonServerConnectionManager.Builder builder()
AxonServerConnectionManager
.
The routingServers
default to "localhost:8024"
and the
TagsConfiguration
is defaulted to TagsConfiguration()
. The
AxonServerConfiguration
is a hard requirements and as such should be provided.
AxonServerConnectionManager
public void registerLifecycleHandlers(@Nonnull Lifecycle.LifecycleRegistry lifecycle)
Lifecycle
registerLifecycleHandlers
in interface Lifecycle
lifecycle
- the lifecycle instance to register the handlers withLifecycle.LifecycleRegistry.onShutdown(int, Runnable)
,
LifecycleRegistry#onShutdown(int, LifecycleHandler)
,
Lifecycle.LifecycleRegistry.onStart(int, Runnable)
,
LifecycleRegistry#onStart(int, LifecycleHandler)
public void start()
AxonServerConnectionManager
. Will enable heartbeat messages to be send to the connected Axon
Server instance in the Phase.INSTRUCTION_COMPONENTS
phase, if this has been enabled through the
AxonServerConfiguration.HeartbeatConfiguration.isEnabled()
.public io.axoniq.axonserver.connector.AxonServerConnection getConnection()
AxonServerConnection
used for the default context of this application.AxonServerConnection
used for the default context of this applicationpublic io.axoniq.axonserver.connector.AxonServerConnection getConnection(String context)
AxonServerConnection
used for the given context
of this application.context
- the context for which to retrieve an AxonServerConnection
AxonServerConnection
used for the given context
of this application.public boolean isConnected(String context)
true
if a gRPC channel for the specific context is opened between client and AxonServer.context
- the (Bounded) Context for which is verified the AxonServer connection through the gRPC
channelpublic void shutdown()
Phase.EXTERNAL_CONNECTIONS
phase.public void disconnect(String context)
context
, forcing a new connection to be established when
one is requested.context
- the context for which the connection must be disconnectedpublic void disconnect()
public String getDefaultContext()
@Deprecated public io.grpc.Channel getChannel()
@Deprecated public io.grpc.Channel getChannel(String context)
public Map<String,Boolean> connections()
ConnectionManager
connections
in interface ConnectionManager
Copyright © 2010–2024. All rights reserved.