public class ControlChannelImpl extends AbstractAxonServerChannel<PlatformInboundInstruction> implements ControlChannel
ControlChannel implementation, serving as the overall control and instruction connection between AxonServer
and a client application.| Constructor and Description |
|---|
ControlChannelImpl(ClientIdentification clientIdentification,
String context,
ScheduledExecutorService executor,
AxonServerManagedChannel channel,
long processorInfoUpdateFrequency,
Runnable reconnectHandler)
Constructs a
ControlChannelImpl. |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect this channel with AxonServer.
|
void |
disableHeartbeat()
Disable any previously enabled heartbeats.
|
void |
disconnect()
Disconnect this channel from AxonServer.
|
void |
enableHeartbeat(long interval,
long timeout,
TimeUnit timeUnit)
Enables sending heartbeat message to validate that the connection to AxonServer is alive.
|
boolean |
isReady()
Validate whether this channel has all required streams connected with AxonServer.
|
void |
reconnect()
Reconnect this channel with AxonServer.
|
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.
|
Registration |
registerInstructionHandler(PlatformOutboundInstruction.RequestCase type,
InstructionHandler<PlatformOutboundInstruction,PlatformInboundInstruction> handler)
Registers the given
handler to handle a given type of instruction. |
CompletableFuture<Void> |
sendInstruction(PlatformInboundInstruction instruction)
Send a the given
instruction over this channel, returning the acknowledgment of the instruction
asynchronously. |
processAck, scheduleImmediateReconnect, scheduleReconnect, sendInstructionpublic ControlChannelImpl(ClientIdentification clientIdentification, String context, ScheduledExecutorService executor, AxonServerManagedChannel channel, long processorInfoUpdateFrequency, Runnable reconnectHandler)
ControlChannelImpl.clientIdentification - the information identifying the client application which is connecting. This
information is used to pass on to messagecontext - the context this ControlChannel operates inexecutor - a ScheduledExecutorService used to schedule reconnects of this
channel, heartbeat message dispatching and processor information updateschannel - the AxonServerManagedChannel used to form the connection with
AxonServerprocessorInfoUpdateFrequency - the update frequency in milliseconds of event processor informationreconnectHandler - operation run when a reconnect request is received for this channelpublic void connect()
AbstractAxonServerChannelconnect in class AbstractAxonServerChannel<PlatformInboundInstruction>public void reconnect()
AbstractAxonServerChannelreconnect in class AbstractAxonServerChannel<PlatformInboundInstruction>public void disconnect()
AbstractAxonServerChanneldisconnect in class AbstractAxonServerChannel<PlatformInboundInstruction>public Registration registerInstructionHandler(PlatformOutboundInstruction.RequestCase type, InstructionHandler<PlatformOutboundInstruction,PlatformInboundInstruction> handler)
ControlChannelhandler to handle a given type of 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.
registerInstructionHandler in interface ControlChanneltype - the type of instructions to handlehandler - the handler to invoke for incoming instructionspublic Registration registerEventProcessor(String processorName, Supplier<EventProcessorInfo> infoSupplier, ProcessorInstructionHandler instructionHandler)
ControlChannelregisterEventProcessor in interface ControlChannelprocessorName - the name of the processorinfoSupplier - supplier for up-to-date status information of the processorinstructionHandler - handler for incoming instructions for the processorpublic void enableHeartbeat(long interval,
long timeout,
TimeUnit timeUnit)
ControlChannelWhen 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.
enableHeartbeat in interface ControlChannelinterval - 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 expressedpublic void disableHeartbeat()
ControlChanneldisableHeartbeat in interface ControlChannelpublic CompletableFuture<Void> sendInstruction(PlatformInboundInstruction instruction)
ControlChannelinstruction over this channel, returning the acknowledgment of the instruction
asynchronously.sendInstruction in interface ControlChannelinstruction - the PlatformInboundInstruction to send over this channelCompletableFuture of the acknowledgement of the given instructionpublic boolean isReady()
AbstractAxonServerChanneltrue.isReady in class AbstractAxonServerChannel<PlatformInboundInstruction>true if this channel is connected with AxonServer or does not require any active connections,
false otherwiseCopyright © 2020–2022 AxonIQ BV. All rights reserved.