Class AxonServerConnectionManager
java.lang.Object
org.axonframework.axonserver.connector.AxonServerConnectionManager
- All Implemented Interfaces:
ConnectionManager
The component which manages all the connections which an Axon client can establish with an Axon Server instance. Does
so by creating
Channels per context and providing them as the means to dispatch/receive messages.- Since:
- 4.0.0
- Author:
- Marc Gathier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate anAxonServerConnectionManager. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAxonServerConnectionManager(AxonServerConnectionManager.Builder builder, io.axoniq.axonserver.connector.AxonServerConnectionFactory connectionFactory) Instantiate aAxonServerConnectionManagerbased on the fields contained in theAxonServerConnectionManager.Builder, using the givenconnectionFactoryto obtain connections to AxonServer. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create anAxonServerConnectionManager.Return the connections this instances manages.voidDisconnects any active connections, forcing a new connection to be established when one is requested.voiddisconnect(String context) Disconnects any active connection for the givencontext, forcing a new connection to be established when one is requested.io.axoniq.axonserver.connector.AxonServerConnectionRetrieves theAxonServerConnectionused for the default context of this application.io.axoniq.axonserver.connector.AxonServerConnectiongetConnection(String context) Retrieves theAxonServerConnectionused for the givencontextof this application.Returns the name of the default context of this application.booleanisConnected(String context) Returnstrueif a gRPC channel for the specific context is opened between client and AxonServer.voidshutdown()Stops the Connection Manager, closing any active connections and preventing new connections from being created.voidstart()Starts theAxonServerConnectionManager.
-
Constructor Details
-
AxonServerConnectionManager
protected AxonServerConnectionManager(AxonServerConnectionManager.Builder builder, io.axoniq.axonserver.connector.AxonServerConnectionFactory connectionFactory) Instantiate aAxonServerConnectionManagerbased on the fields contained in theAxonServerConnectionManager.Builder, using the givenconnectionFactoryto obtain connections to AxonServer.- Parameters:
builder- theAxonServerConnectionManager.Builderused to instantiate aAxonServerConnectionManagerinstanceconnectionFactory- a configured instance of the AxonServerConnectionFactory
-
-
Method Details
-
builder
Instantiate a Builder to be able to create anAxonServerConnectionManager.The
routingServersdefault to"localhost:8024"and theTagsConfigurationis defaulted toTagsConfiguration(). TheAxonServerConfigurationis a hard requirements and as such should be provided.- Returns:
- a Builder to be able to create a
AxonServerConnectionManager
-
start
public void start()Starts theAxonServerConnectionManager. Will enable heartbeat messages to be sent to the connected Axon Server instance in thePhase.INSTRUCTION_COMPONENTSphase, if this has been enabled through theAxonServerConfiguration.HeartbeatConfiguration.isEnabled(). -
getConnection
public io.axoniq.axonserver.connector.AxonServerConnection getConnection()Retrieves theAxonServerConnectionused for the default context of this application.- Returns:
- the
AxonServerConnectionused for the default context of this application
-
getConnection
Retrieves theAxonServerConnectionused for the givencontextof this application.- Parameters:
context- the context for which to retrieve anAxonServerConnection- Returns:
- the
AxonServerConnectionused for the givencontextof this application.
-
isConnected
Returnstrueif a gRPC channel for the specific context is opened between client and AxonServer.- Parameters:
context- the (Bounded) Context for which is verified the AxonServer connection through the gRPC channel- Returns:
- if the gRPC channel is opened, false otherwise
-
shutdown
public void shutdown()Stops the Connection Manager, closing any active connections and preventing new connections from being created. This shutdown operation is performed in thePhase.EXTERNAL_CONNECTIONSphase. -
disconnect
Disconnects any active connection for the givencontext, forcing a new connection to be established when one is requested.- Parameters:
context- the context for which the connection must be disconnected
-
disconnect
public void disconnect()Disconnects any active connections, forcing a new connection to be established when one is requested. -
getDefaultContext
Returns the name of the default context of this application.- Returns:
- the name of the default context of this application
-
connections
Description copied from interface:ConnectionManagerReturn the connections this instances manages. Consists of key-value pairs where the key resembles the context name and the value describes whether the connection is active at this moment.- Specified by:
connectionsin interfaceConnectionManager- Returns:
- Return the connections this instances manages.
-