Class AdminChannelImpl
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.AbstractAxonServerChannel<Void>
-
- io.axoniq.axonserver.connector.admin.impl.AdminChannelImpl
-
- All Implemented Interfaces:
AdminChannel
public class AdminChannelImpl extends AbstractAxonServerChannel<Void> implements AdminChannel
AdminChannelGRPC implementation to allow a client application sending and receiving administration related messages to and from Axon Server.- Since:
- 4.6.0
- Author:
- Sara Pellegrini, Stefan Dragisic
-
-
Field Summary
-
Fields inherited from interface io.axoniq.axonserver.connector.admin.AdminChannel
CHANNEL_CONTEXT
-
-
Constructor Summary
Constructors Constructor Description AdminChannelImpl(ClientIdentification clientIdentification, ScheduledExecutorService executor, AxonServerManagedChannel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>addNodeToReplicationGroup(JoinReplicationGroup request)Request to add a node to a replication group.CompletableFuture<ApplicationRoles>authenticateToken(String token)Authenticate an application token against the information available in Axon Server.CompletableFuture<UserRoles>authenticateUser(String username, String password)Authenticate a user against the information available in Axon Server.voidconnect()Connect this channel with AxonServer.CompletableFuture<Void>createContext(CreateContextRequest request)Request to create an Axon Server context.CompletableFuture<Token>createOrUpdateApplication(ApplicationRequest request)Request to create an Axon Server application, or update it if it's already present.CompletableFuture<Void>createOrUpdateUser(CreateOrUpdateUserRequest request)Request to create an Axon Server user, or update it if it's already present.CompletableFuture<Void>createReplicationGroup(CreateReplicationGroupRequest request)Request to create a replication group.CompletableFuture<Void>deleteApplication(String applicationName)Request to delete application in Axon Server.CompletableFuture<Void>deleteContext(DeleteContextRequest request)Request to delete a context in Axon Server.CompletableFuture<Void>deleteReplicationGroup(DeleteReplicationGroupRequest request)Request to delete a replication group in Axon Server.CompletableFuture<Void>deleteUser(String username)Request to delete a user in Axon Server.voiddisconnect()Disconnect this channel from AxonServer.ResultStream<EventProcessor>eventProcessors()Returns all the event processor registered to AxonServer.ResultStream<EventProcessor>eventProcessorsByComponent(String component)Returns all the event processor registered by the specified application.CompletableFuture<List<ApplicationOverview>>getAllApplications()Request to list all applications in Axon Server.CompletableFuture<ConnectedApplicationOverview>getAllConnectedApplications(String contextName)Request to list all connected applications in Axon Server.CompletableFuture<List<ContextOverview>>getAllContexts()Request to list all contexts in Axon Server.CompletableFuture<List<NodeOverview>>getAllNodes()Request to list all nodes in Axon Server.CompletableFuture<List<ReplicationGroupOverview>>getAllReplicationGroups()Request to list all replication groups in Axon Server.CompletableFuture<List<UserOverview>>getAllUsers()Request to list all users in Axon Server.CompletableFuture<ApplicationOverview>getApplication(String applicationName)Request to retrieve application overview in Axon Server.CompletableFuture<List<LoadBalancingStrategy>>getBalancingStrategies()Returns all available load balance strategies registered to AxonServer.CompletableFuture<ContextOverview>getContextOverview(String context)Request to retrieve aContextOverviewfrom Axon Server.CompletableFuture<ReplicationGroupOverview>getReplicationGroup(String replicationGroup)Request to retrieve replication group overview in Axon Server.booleanisReady()Validate whether this channel has all required streams connected with AxonServer.CompletableFuture<Void>loadBalanceEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String strategy)Request to balance the load for the giveneventProcessorNamewithin the connected client.CompletableFuture<Result>mergeEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String context)Request to merge the two smallest segments of a specific event processor in a specific context.CompletableFuture<Result>moveEventProcessorSegment(String eventProcessorName, String tokenStoreIdentifier, int segmentId, String targetClientIdentifier)Requests to move a specific event processor segment to a certain client.CompletableFuture<Result>pauseEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String contextName)Request to pause a specific event processor in a specific context.voidreconnect()Reconnect this channel with AxonServer.CompletableFuture<Token>refreshToken(String applicationName)Request to refresh token of application in Axon Server.CompletableFuture<Void>removeNodeFromReplicationGroup(LeaveReplicationGroup request)Request to remove a node from a replication group.CompletableFuture<Void>setAutoLoadBalanceStrategy(String eventProcessorName, String tokenStoreIdentifier, String strategy)Updates the autoloadbalance strategy for aeventProcessorNamewithin the connected client.CompletableFuture<Result>splitEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String context)Request to split the biggest segment of a specific event processor in a specific context.CompletableFuture<Result>startEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String contextName)Request to start a specific event processor in a specific context.ResultStream<ContextUpdate>subscribeToContextUpdates()Subscribes and listens to context updates from Axon Server, like when a context is created or deleted.CompletableFuture<Void>updateContextProperties(UpdateContextPropertiesRequest request)Request to update the properties for an Axon Server context.-
Methods inherited from class io.axoniq.axonserver.connector.impl.AbstractAxonServerChannel
processAck, scheduleImmediateReconnect, scheduleReconnect, sendInstruction
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.axoniq.axonserver.connector.admin.AdminChannel
mergeEventProcessor, pauseEventProcessor, splitEventProcessor, startEventProcessor
-
-
-
-
Constructor Detail
-
AdminChannelImpl
public AdminChannelImpl(ClientIdentification clientIdentification, ScheduledExecutorService executor, AxonServerManagedChannel channel)
-
-
Method Detail
-
eventProcessors
public ResultStream<EventProcessor> eventProcessors()
Description copied from interface:AdminChannelReturns all the event processor registered to AxonServer.- Specified by:
eventProcessorsin interfaceAdminChannel- Returns:
- the stream of all event processor registered to AxonServer.
-
eventProcessorsByComponent
public ResultStream<EventProcessor> eventProcessorsByComponent(String component)
Description copied from interface:AdminChannelReturns all the event processor registered by the specified application.- Specified by:
eventProcessorsByComponentin interfaceAdminChannel- Parameters:
component- the component name- Returns:
- the stream of all event processor registered to AxonServer by the specified application.
-
pauseEventProcessor
public CompletableFuture<Result> pauseEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String contextName)
Description copied from interface:AdminChannelRequest to pause a specific event processor in a specific context. Returns aCompletableFuturethat completes when the pause has been performed. TheCompletableFuturecompletes withResultACCEPTED, if the client application running the event processor is using a version of the connector prior to 4.6.0.- Specified by:
pauseEventProcessorin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to pausetokenStoreIdentifier- the token store identifier of the processor to pausecontextName- the name of the context where the event processor is- Returns:
- a
CompletableFuturethat completes when the pause has been performed
-
startEventProcessor
public CompletableFuture<Result> startEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String contextName)
Description copied from interface:AdminChannelRequest to start a specific event processor in a specific context. Returns aCompletableFuturethat completes when the start has been performed TheCompletableFuturecompletes withResultACCEPTED, if the client application running the event processor is using a version of the connector prior to 4.6.0.- Specified by:
startEventProcessorin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to starttokenStoreIdentifier- the token store identifier of the processor to startcontextName- the name of the context where the event processor is- Returns:
- a
CompletableFuturethat completes when the start has been performed
-
splitEventProcessor
public CompletableFuture<Result> splitEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String context)
Description copied from interface:AdminChannelRequest to split the biggest segment of a specific event processor in a specific context. Returns aCompletableFuturethat completes when the split has been performed TheCompletableFuturecompletes withResultACCEPTED, if the client application running the event processor is using a version of the connector prior to 4.6.0.- Specified by:
splitEventProcessorin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to splittokenStoreIdentifier- the token store identifier of the processor to splitcontext- the name of the context where the event processor is- Returns:
- a
CompletableFuturethat completes when the split has been performed
-
mergeEventProcessor
public CompletableFuture<Result> mergeEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String context)
Description copied from interface:AdminChannelRequest to merge the two smallest segments of a specific event processor in a specific context. Returns aCompletableFuturethat completes when the merge has been performed TheCompletableFuturecompletes withResultACCEPTED, if the client application running the event processor is using a version of the connector prior to 4.6.0.- Specified by:
mergeEventProcessorin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to mergetokenStoreIdentifier- the token store identifier of the processor to mergecontext- the name of the context where the event processor is- Returns:
- a
CompletableFuturethat completes when the merge has been performed
-
moveEventProcessorSegment
public CompletableFuture<Result> moveEventProcessorSegment(String eventProcessorName, String tokenStoreIdentifier, int segmentId, String targetClientIdentifier)
Description copied from interface:AdminChannelRequests to move a specific event processor segment to a certain client. Returns aCompletableFuturethat completes when all clients other than thetargetClientIdentifierrelease or disregard the segment for claiming. There is no guarantee that the target client has already claimed the segment when the result completes.- Specified by:
moveEventProcessorSegmentin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to movetokenStoreIdentifier- the token store identifier of the processor to movesegmentId- the identifier of the segment to movetargetClientIdentifier- the desired destination for the segment- Returns:
- a
CompletableFuturethat completes when all the other clients released the segment or disregard the segment for claiming. There is no guarantee that the target client has already claimed the segment when the result completes.
-
loadBalanceEventProcessor
public CompletableFuture<Void> loadBalanceEventProcessor(String eventProcessorName, String tokenStoreIdentifier, String strategy)
Description copied from interface:AdminChannelRequest to balance the load for the giveneventProcessorNamewithin the connected client. Returns aCompletableFuturethat completes when the request has been received by Axon Server. Note that this doesn't imply that the processor is balanced, but only that the request has been properly delivered.- Specified by:
loadBalanceEventProcessorin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to balance the load fortokenStoreIdentifier- the token store identifier of the processor to balance the load forstrategy- the balancing strategy to use- Returns:
- a
CompletableFuturethat completes when the request is delivered to Axon Server
-
setAutoLoadBalanceStrategy
public CompletableFuture<Void> setAutoLoadBalanceStrategy(String eventProcessorName, String tokenStoreIdentifier, String strategy)
Description copied from interface:AdminChannelUpdates the autoloadbalance strategy for aeventProcessorNamewithin the connected client. Returns aCompletableFuturethat completes when the request has been received by Axon Server. Note that this doesn't imply that the processor is balanced, but only that the request has been properly delivered.- Specified by:
setAutoLoadBalanceStrategyin interfaceAdminChannel- Parameters:
eventProcessorName- the name of the event processor to balance the load fortokenStoreIdentifier- the token store identifier of the processor to balance the load forstrategy- the balancing strategy to use- Returns:
- a
CompletableFuturethat completes when the request is delivered to Axon Server
-
getBalancingStrategies
public CompletableFuture<List<LoadBalancingStrategy>> getBalancingStrategies()
Description copied from interface:AdminChannelReturns all available load balance strategies registered to AxonServer.- Specified by:
getBalancingStrategiesin interfaceAdminChannel- Returns:
- the list of all available load balance strategies registered to AxonServer.
-
createOrUpdateUser
public CompletableFuture<Void> createOrUpdateUser(CreateOrUpdateUserRequest request)
Description copied from interface:AdminChannelRequest to create an Axon Server user, or update it if it's already present. Returns aCompletableFuturethat completes when the request has been processed by AxonServer.- Specified by:
createOrUpdateUserin interfaceAdminChannel- Parameters:
request-CreateOrUpdateUserRequestto create the user, containing the username, password and user roles- Returns:
- a
CompletableFuturethat completes when the request has been processed by Axon Server
-
getAllUsers
public CompletableFuture<List<UserOverview>> getAllUsers()
Description copied from interface:AdminChannelRequest to list all users in Axon Server.- Specified by:
getAllUsersin interfaceAdminChannel- Returns:
- a
CompletableFuturethat contains list of allUserOverviewin Axon Server.
-
getAllNodes
public CompletableFuture<List<NodeOverview>> getAllNodes()
Description copied from interface:AdminChannelRequest to list all nodes in Axon Server.- Specified by:
getAllNodesin interfaceAdminChannel- Returns:
- a
CompletableFuturethat contains list of allNodeOverviewin Axon Server.
-
deleteUser
public CompletableFuture<Void> deleteUser(String username)
Description copied from interface:AdminChannelRequest to delete a user in Axon Server.- Specified by:
deleteUserin interfaceAdminChannel- Parameters:
username- is the username of the user to delete- Returns:
- a
CompletableFuturethat completes when the user has been deleted
-
createOrUpdateApplication
public CompletableFuture<Token> createOrUpdateApplication(ApplicationRequest request)
Description copied from interface:AdminChannelRequest to create an Axon Server application, or update it if it's already present. Returns aCompletableFuturethat completes when the request has been processed by Axon Server.- Specified by:
createOrUpdateApplicationin interfaceAdminChannel- Parameters:
request-ApplicationRequestto create the application- Returns:
- a
CompletableFuturethat contains applicationTokenand completes when the request has been processed by Axon Server
-
getAllApplications
public CompletableFuture<List<ApplicationOverview>> getAllApplications()
Description copied from interface:AdminChannelRequest to list all applications in Axon Server.- Specified by:
getAllApplicationsin interfaceAdminChannel- Returns:
- a
CompletableFuturethat contains list of allApplicationOverviewin Axon Server.
-
getApplication
public CompletableFuture<ApplicationOverview> getApplication(String applicationName)
Description copied from interface:AdminChannelRequest to retrieve application overview in Axon Server.- Specified by:
getApplicationin interfaceAdminChannel- Parameters:
applicationName- is the name of the application to retrieve- Returns:
- a
CompletableFuturecontainingApplicationOverviewwith data such as name, roles, etc.
-
refreshToken
public CompletableFuture<Token> refreshToken(String applicationName)
Description copied from interface:AdminChannelRequest to refresh token of application in Axon Server.- Specified by:
refreshTokenin interfaceAdminChannel- Parameters:
applicationName- is the name of the application to refresh token- Returns:
- a
CompletableFuturecontaining newToken
-
deleteApplication
public CompletableFuture<Void> deleteApplication(String applicationName)
Description copied from interface:AdminChannelRequest to delete application in Axon Server.- Specified by:
deleteApplicationin interfaceAdminChannel- Parameters:
applicationName- is the name of the application to delete- Returns:
- a
CompletableFuturethat completes when application has been deleted
-
getAllConnectedApplications
public CompletableFuture<ConnectedApplicationOverview> getAllConnectedApplications(String contextName)
Description copied from interface:AdminChannelRequest to list all connected applications in Axon Server.- Specified by:
getAllConnectedApplicationsin interfaceAdminChannel- Returns:
- a
CompletableFuturethat containsConnectedApplicationOverviewin Axon Server.
-
createContext
public CompletableFuture<Void> createContext(CreateContextRequest request)
Description copied from interface:AdminChannelRequest to create an Axon Server context. Returns aCompletableFuturethat completes when the request has been processed by Axon Server.- Specified by:
createContextin interfaceAdminChannel- Parameters:
request-CreateContextRequestto create the context- Returns:
- a
CompletableFuturethat completes when the request has been processed by Axon Server
-
updateContextProperties
public CompletableFuture<Void> updateContextProperties(UpdateContextPropertiesRequest request)
Description copied from interface:AdminChannelRequest to update the properties for an Axon Server context. Returns aCompletableFuturethat completes when the request has been processed by Axon Server.- Specified by:
updateContextPropertiesin interfaceAdminChannel- Parameters:
request-UpdateContextPropertiesRequestto update the context properties- Returns:
- a
CompletableFuturethat completes when the request has been processed by Axon Server
-
deleteContext
public CompletableFuture<Void> deleteContext(DeleteContextRequest request)
Description copied from interface:AdminChannelRequest to delete a context in Axon Server.- Specified by:
deleteContextin interfaceAdminChannel- Parameters:
request-DeleteContextRequestto delete the context, containing the context name and option to preserve event store.- Returns:
- a
CompletableFuturethat completes when context has been deleted
-
getContextOverview
public CompletableFuture<ContextOverview> getContextOverview(String context)
Description copied from interface:AdminChannelRequest to retrieve aContextOverviewfrom Axon Server.- Specified by:
getContextOverviewin interfaceAdminChannel- Parameters:
context- the name of theContextOverviewto retrieve- Returns:
- a
CompletableFuturecontainingContextOverviewdata such as name, roles, etc.
-
getAllContexts
public CompletableFuture<List<ContextOverview>> getAllContexts()
Description copied from interface:AdminChannelRequest to list all contexts in Axon Server.- Specified by:
getAllContextsin interfaceAdminChannel- Returns:
- a
CompletableFuturethat contains a list of allContextOverviewin Axon Server.
-
subscribeToContextUpdates
public ResultStream<ContextUpdate> subscribeToContextUpdates()
Description copied from interface:AdminChannelSubscribes and listens to context updates from Axon Server, like when a context is created or deleted.- Specified by:
subscribeToContextUpdatesin interfaceAdminChannel- Returns:
- a
ResultStreamthat streamsContextUpdate.
-
addNodeToReplicationGroup
public CompletableFuture<Void> addNodeToReplicationGroup(JoinReplicationGroup request)
Description copied from interface:AdminChannelRequest to add a node to a replication group. Returns aCompletableFuturethat completes when the request has been processed by AxonServer.- Specified by:
addNodeToReplicationGroupin interfaceAdminChannel- Parameters:
request-JoinReplicationGroupto add a node to replication group, containing the replication group name, the node name, role...- Returns:
- a
CompletableFuturethat completes when the request has been processed to AxonServer
-
createReplicationGroup
public CompletableFuture<Void> createReplicationGroup(CreateReplicationGroupRequest request)
Description copied from interface:AdminChannelRequest to create a replication group. Returns aCompletableFuturethat completes when the request has been processed by Axon Server.- Specified by:
createReplicationGroupin interfaceAdminChannel- Parameters:
request-CreateReplicationGroupRequestto create replication group, containing the replication group name, the node name, role...- Returns:
- a
CompletableFuturethat completes when the request has been processed to AxonServer
-
deleteReplicationGroup
public CompletableFuture<Void> deleteReplicationGroup(DeleteReplicationGroupRequest request)
Description copied from interface:AdminChannelRequest to delete a replication group in Axon Server.- Specified by:
deleteReplicationGroupin interfaceAdminChannel- Parameters:
request-DeleteReplicationGroupRequestto delete the replication group, containing the replication group name and option to preserve event store.- Returns:
- a
CompletableFuturethat completes when the replication group has been deleted
-
getReplicationGroup
public CompletableFuture<ReplicationGroupOverview> getReplicationGroup(String replicationGroup)
Description copied from interface:AdminChannelRequest to retrieve replication group overview in Axon Server.- Specified by:
getReplicationGroupin interfaceAdminChannel- Parameters:
replicationGroup- is the name of the replication group to retrieve- Returns:
- a
CompletableFuturecontainingReplicationGroupOverviewdata such as members, contexts roles, etc.
-
removeNodeFromReplicationGroup
public CompletableFuture<Void> removeNodeFromReplicationGroup(LeaveReplicationGroup request)
Description copied from interface:AdminChannelRequest to remove a node from a replication group. Returns aCompletableFuturethat completes when the request has been processed by Axon Server.- Specified by:
removeNodeFromReplicationGroupin interfaceAdminChannel- Parameters:
request-LeaveReplicationGroupto a node to be removed from replication group- Returns:
- a
CompletableFuturethat completes when the request has been processed by Axon Server
-
getAllReplicationGroups
public CompletableFuture<List<ReplicationGroupOverview>> getAllReplicationGroups()
Description copied from interface:AdminChannelRequest to list all replication groups in Axon Server.- Specified by:
getAllReplicationGroupsin interfaceAdminChannel- Returns:
- a
CompletableFuturethat contains list of allReplicationGroupOverviewin Axon Server.
-
authenticateUser
public CompletableFuture<UserRoles> authenticateUser(String username, String password)
Description copied from interface:AdminChannelAuthenticate a user against the information available in Axon Server. Returns aUserRolesobject containing the roles for the user. Completes with an exception if the username/password combination is invalid. Requires Axon Server 2023.0 or higher.- Specified by:
authenticateUserin interfaceAdminChannel- Parameters:
username- the login name of the userpassword- the password of the user- Returns:
- roles for the user
-
authenticateToken
public CompletableFuture<ApplicationRoles> authenticateToken(String token)
Description copied from interface:AdminChannelAuthenticate an application token against the information available in Axon Server. Returns aApplicationRolesobject containing the roles for the application. Completes with an exception if the token is invalid. Requires Axon Server 2023.0 or higher.- Specified by:
authenticateTokenin interfaceAdminChannel- Parameters:
token- the application token- Returns:
- roles for the application
-
connect
public void connect()
Description copied from class:AbstractAxonServerChannelConnect this channel with AxonServer.- Specified by:
connectin classAbstractAxonServerChannel<Void>
-
reconnect
public void reconnect()
Description copied from class:AbstractAxonServerChannelReconnect this channel with AxonServer.- Specified by:
reconnectin classAbstractAxonServerChannel<Void>
-
disconnect
public void disconnect()
Description copied from class:AbstractAxonServerChannelDisconnect this channel from AxonServer.- Specified by:
disconnectin classAbstractAxonServerChannel<Void>
-
isReady
public boolean isReady()
Description copied from class:AbstractAxonServerChannelValidate whether this channel has all required streams connected with AxonServer. If the state of the channel does not require any active streams, it is considered ready and will returntrue.- Specified by:
isReadyin classAbstractAxonServerChannel<Void>- Returns:
trueif this channel is connected with AxonServer or does not require any active connections,falseotherwise
-
-