Interface ControlChannel
-
- All Known Implementing Classes:
ControlChannelImpl
public interface ControlChannelCommunication channel for interactions with AxonServer related to control messages and statistics.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddisableHeartbeat()Disable any previously enabled heartbeats.voidenableHeartbeat(long interval, long timeout, TimeUnit timeUnit)Enables sending heartbeat message to validate that the connection to AxonServer is alive.RegistrationregisterEventProcessor(String processorName, Supplier<EventProcessorInfo> infoSupplier, ProcessorInstructionHandler instructionHandler)Registers an Event Processor with AxonServer, allowing AxonServer to request status information and provide instructions for the Processor.RegistrationregisterInstructionHandler(PlatformOutboundInstruction.RequestCase type, InstructionHandler<PlatformOutboundInstruction,PlatformInboundInstruction> handler)Registers the givenhandlerto handle a giventypeof instruction.RegistrationregisterTopologyChangeHandler(Consumer<TopologyChange> handler)Registers a handler for changes in the topology of AxonServer.CompletableFuture<Void>sendInstruction(PlatformInboundInstruction instruction)Send a the giveninstructionover this channel, returning the acknowledgment of theinstructionasynchronously.
-
-
-
Method Detail
-
registerInstructionHandler
Registration registerInstructionHandler(PlatformOutboundInstruction.RequestCase type, InstructionHandler<PlatformOutboundInstruction,PlatformInboundInstruction> handler)
Registers the givenhandlerto handle a giventypeof instruction. Any previous registrations of handlers for the given type of instruction are overwritten.Note that de-registration of a handler will not reinstate any previously registered handler for the same type of instruction.
This method is intended to overwrite the default behavior for incoming instructions, or to provide support for non-default instructions.
- Parameters:
type- the type of instructions to handlehandler- the handler to invoke for incoming instructions- Returns:
- a handle to deregister this instruction handler
-
registerTopologyChangeHandler
Registration registerTopologyChangeHandler(Consumer<TopologyChange> handler)
Registers a handler for changes in the topology of AxonServer. This handler will be invoked whenever there is a change in the topology, such as a new command or query handler being registered, or a handler being deregistered.- Parameters:
handler- for changes in the topology of AxonServer.- Returns:
- a handle to deregister the topology change handler
-
registerEventProcessor
Registration registerEventProcessor(String processorName, Supplier<EventProcessorInfo> infoSupplier, ProcessorInstructionHandler instructionHandler)
Registers an Event Processor with AxonServer, allowing AxonServer to request status information and provide instructions for the Processor.- Parameters:
processorName- the name of the processorinfoSupplier- supplier for up-to-date status information of the processorinstructionHandler- handler for incoming instructions for the processor- Returns:
- a handle to cancel the registration of the event processor
-
enableHeartbeat
void enableHeartbeat(long interval, long timeout, TimeUnit timeUnit)Enables sending heartbeat message to validate that the connection to AxonServer is alive. This ensures a fully operational end-to-end connection with AxonServer.When enabled, the client will abandon any connections on which no timely response to a heartbeat has been received. If heartbeats are also enabled on the AxonServer side, any heartbeat initiated by AxonServer will count as a valid connection confirmation.
Consecutive invocations of this method will alter the configuration, resetting heartbeat timers and reinitialize the heartbeat processing.
- Parameters:
interval- the interval at which heartbeat messages are expectedtimeout- the maximum time to wait for a confirmation after initiating a heartbeat messagetimeUnit- the unit of time in which interval and timeout are expressed
-
disableHeartbeat
void disableHeartbeat()
Disable any previously enabled heartbeats. Heartbeat requests initiated by AxonServer will still be reacted to, but the client will no longer initiate a heartbeat, nor close a connection when it fails to receive confirmations.
-
sendInstruction
CompletableFuture<Void> sendInstruction(PlatformInboundInstruction instruction)
Send a the giveninstructionover this channel, returning the acknowledgment of theinstructionasynchronously.- Parameters:
instruction- thePlatformInboundInstructionto send over this channel- Returns:
- a
CompletableFutureof the acknowledgement of the giveninstruction
-
-