Class ContextConnection
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.ContextConnection
-
- All Implemented Interfaces:
AxonServerConnection
public class ContextConnection extends Object implements AxonServerConnection
Implementation of theAxonServerConnection, carrying context information with the overall connection. The context information can be used to support the notion of bounded contexts or multi-tenancy for example.
-
-
Constructor Summary
Constructors Constructor Description ContextConnection(ClientIdentification clientIdentification, ScheduledExecutorService executorService, AxonServerManagedChannel connection, long processorInfoUpdateFrequency, int commandPermits, int queryPermits, String context, Consumer<ContextConnection> onShutdown)Construct aContextConnectioncarrying context information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdminChanneladminChannel()Returns the channel on which administration messages can be sent and receivedCommandChannelcommandChannel()Returns the channel on which Command related interactions can be performed with AxonServer.voidconnect()Ensure there is a connection with theControlChannelthis connection provides.ControlChannelcontrolChannel()Returns the channel on which platform control messages can be sent and received.DcbEventChanneldcbEventChannel()Returns the channel on which Event related interactions can be performed with Axon Server using the Dynamic Consistency Boundary concept.voiddisconnect()Disconnects all communication channels and terminates any active network connections to AxonServer.EventChanneleventChannel()Returns the channel on which Event related interactions can be performed with AxonServer.EventTransformationChanneleventTransformationChannel()Returns the channel on which Event transformations can be performed with AxonServer.AxonServerManagedChannelgetManagedChannel()Retrieve theAxonServerManagedChannelused to create connection with.booleanisConnected()Indicates whether the underlying connection is active.booleanisConnectionFailed()Indicates whether the underlying connection failed.booleanisReady()Indicates whether the connection is ready to process and receive instructions.QueryChannelqueryChannel()Returns the channel on which Query related interactions can be performed with AxonServer.SnapshotChannelsnapshotChannel()Returns the channel on which Snapshotting can be performed with AxonServer.
-
-
-
Constructor Detail
-
ContextConnection
public ContextConnection(ClientIdentification clientIdentification, ScheduledExecutorService executorService, AxonServerManagedChannel connection, long processorInfoUpdateFrequency, int commandPermits, int queryPermits, String context, Consumer<ContextConnection> onShutdown)
Construct aContextConnectioncarrying context information.- Parameters:
clientIdentification- client information identifying whom has connected. This information is used to pass on to messageexecutorService- aScheduledExecutorServiceused to schedule reconnects in the channels this connection providesconnection- theAxonServerManagedChannelused to form the connections with AxonServerprocessorInfoUpdateFrequency- the update frequency in milliseconds of event processor informationcommandPermits- the number of permits for command streamsqueryPermits- the number of permits for query streamscontext- the context this connection belongs toonShutdown- a shutdown hook to invoke whenever thisContextConnectiondisconnects
-
-
Method Detail
-
isConnectionFailed
public boolean isConnectionFailed()
Description copied from interface:AxonServerConnectionIndicates whether the underlying connection failed. This may occur when AxonServer cannot be reached.- Specified by:
isConnectionFailedin interfaceAxonServerConnection- Returns:
truewhen the underlying connection failed, otherwisefalse
-
isReady
public boolean isReady()
Description copied from interface:AxonServerConnectionIndicates whether the connection is ready to process and receive instructions. A connection is considered ready when it is connected (seeAxonServerConnection.isConnected()and if all previously active communication channels (e.g. command, query, instruction) have been activated.- Specified by:
isReadyin interfaceAxonServerConnection- Returns:
trueif the underlying connection is ready, otherwisefalse
-
isConnected
public boolean isConnected()
Description copied from interface:AxonServerConnectionIndicates whether the underlying connection is active. This means a network connection has been made with an AxonServer instance.- Specified by:
isConnectedin interfaceAxonServerConnection- Returns:
trueif a network connection to AxonServer is available, otherwisefalse
-
disconnect
public void disconnect()
Description copied from interface:AxonServerConnectionDisconnects all communication channels and terminates any active network connections to AxonServer. No more operations can be performed on this connection after invokingdisconnect().- Specified by:
disconnectin interfaceAxonServerConnection
-
controlChannel
public ControlChannel controlChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which platform control messages can be sent and received.- Specified by:
controlChannelin interfaceAxonServerConnection- Returns:
- the channel for platform instructions
-
connect
public void connect()
Ensure there is a connection with theControlChannelthis connection provides.
-
commandChannel
public CommandChannel commandChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Command related interactions can be performed with AxonServer.- Specified by:
commandChannelin interfaceAxonServerConnection- Returns:
- the channel for Command messaging
-
eventChannel
public EventChannel eventChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Event related interactions can be performed with AxonServer.- Specified by:
eventChannelin interfaceAxonServerConnection- Returns:
- the channel for Event messaging
-
snapshotChannel
public SnapshotChannel snapshotChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Snapshotting can be performed with AxonServer.- Specified by:
snapshotChannelin interfaceAxonServerConnection- Returns:
- the channel for Snapshotting
-
dcbEventChannel
public DcbEventChannel dcbEventChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Event related interactions can be performed with Axon Server using the Dynamic Consistency Boundary concept.- Specified by:
dcbEventChannelin interfaceAxonServerConnection- Returns:
- the channel for Event messaging
-
queryChannel
public QueryChannel queryChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Query related interactions can be performed with AxonServer.- Specified by:
queryChannelin interfaceAxonServerConnection- Returns:
- the channel for Query messaging
-
eventTransformationChannel
public EventTransformationChannel eventTransformationChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which Event transformations can be performed with AxonServer.- Specified by:
eventTransformationChannelin interfaceAxonServerConnection- Returns:
- the channel for Event transformations
-
adminChannel
public AdminChannel adminChannel()
Description copied from interface:AxonServerConnectionReturns the channel on which administration messages can be sent and received- Specified by:
adminChannelin interfaceAxonServerConnection- Returns:
- the channel for Admin messaging
-
getManagedChannel
public AxonServerManagedChannel getManagedChannel()
Retrieve theAxonServerManagedChannelused to create connection with.- Returns:
- the
AxonServerManagedChannelused to create connection with
-
-