OUT - generic defining the type of instructions a channel implementation can sendpublic abstract class AbstractAxonServerChannel<OUT> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAxonServerChannel(ClientIdentification clientIdentification,
ScheduledExecutorService executor,
AxonServerManagedChannel axonServerManagedChannel)
Instantiate an
AbstractAxonServerChannel. |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
connect()
Connect this channel with AxonServer.
|
abstract void |
disconnect()
Disconnect this channel from AxonServer.
|
abstract boolean |
isReady()
Validate whether this channel has all required streams connected with AxonServer.
|
protected void |
processAck(InstructionAck ack)
Process the given
ack by completing the instruction it refers to, if any can be found. |
abstract void |
reconnect()
Reconnect this channel with AxonServer.
|
protected void |
scheduleImmediateReconnect()
Schedule an immediate attempt to reconnect with AxonServer.
|
protected void |
scheduleReconnect(Throwable disconnectReason)
Schedule an attempt to reconnect with AxonServer.
|
protected CompletableFuture<Void> |
sendInstruction(OUT instruction,
Function<OUT,String> instructionIdProvider,
io.grpc.stub.StreamObserver<OUT> outboundStream)
Send the given
instruction over the given outboundStream. |
protected AbstractAxonServerChannel(ClientIdentification clientIdentification, ScheduledExecutorService executor, AxonServerManagedChannel axonServerManagedChannel)
AbstractAxonServerChannel.executor - a ScheduledExecutorService used to schedule reconnectionsaxonServerManagedChannel - the AxonServerManagedChannel used to connect to AxonServerprotected CompletableFuture<Void> sendInstruction(OUT instruction, Function<OUT,String> instructionIdProvider, io.grpc.stub.StreamObserver<OUT> outboundStream)
instruction over the given outboundStream. Will use the given instructionIdProvider to retrieve the instruction identifier to keep track when the instruction has been
acknowledged.instruction - the instruction of type OUT to sendinstructionIdProvider - extraction function retrieving the instruction identifier from the given instructionoutboundStream - StreamObserver to send the given instruction overCompletableFuture resolving successfully or exceptionally depending on the outcome of the
dispatched instructionprotected void processAck(InstructionAck ack)
ack by completing the instruction it refers to, if any can be found.ack - the InstructionAck referring to an instruction which has been sent through the sendInstruction(Object, Function, StreamObserver) methodprotected void scheduleReconnect(Throwable disconnectReason)
disconnectReason, the reconnect
attempt will be executed within 500ms or 5000ms.disconnectReason - The reason why the previous connection failed.protected void scheduleImmediateReconnect()
public abstract void connect()
public abstract void reconnect()
public abstract void disconnect()
public abstract boolean isReady()
true.true if this channel is connected with AxonServer or does not require any active connections,
false otherwiseCopyright © 2020–2022 AxonIQ BV. All rights reserved.