IN - the type of instructions received by this streamOUT - the type of instructions returned by this streampublic abstract class AbstractIncomingInstructionStream<IN,OUT> extends FlowControlledStream<IN,OUT>
FlowControlledStream for incoming message from AxonServer.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractIncomingInstructionStream(String clientId,
int permits,
int permitsBatch,
Consumer<Throwable> disconnectHandler,
Consumer<io.grpc.stub.CallStreamObserver<OUT>> beforeStartHandler)
Construct an
AbstractIncomingInstructionStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeStart(io.grpc.stub.ClientCallStreamObserver<OUT> requestStream) |
protected abstract OUT |
buildAckMessage(InstructionAck ack)
Builds a stream specific acknowledgment message of type
OUT based on the given ack. |
protected Optional<OUT> |
buildResultMessage(InstructionResult result)
Builds a stream specific result message of type
OUT based on the given result. |
protected abstract InstructionHandler<IN,OUT> |
getHandler(IN msgIn)
Retrieves an
InstructionHandler capable of handling the given msgIn. |
protected abstract String |
getInstructionId(IN instruction)
Returns the instruction identifier of the given
instruction. |
io.grpc.stub.ClientCallStreamObserver<OUT> |
getInstructionsForPlatform()
Return the
StreamObserver of type OUT serving as the outbound instruction channel. |
void |
onCompleted() |
void |
onError(Throwable t) |
void |
onNext(IN value) |
protected abstract boolean |
unregisterOutboundStream(io.grpc.stub.CallStreamObserver<OUT> expected)
Deregisters this stream's outbound stream, granted that it matches the given
expected StreamObserver. |
buildFlowControlMessage, buildInitialFlowControlMessage, enableFlowControl, markConsumed, outboundStreamprotected AbstractIncomingInstructionStream(String clientId, int permits, int permitsBatch, Consumer<Throwable> disconnectHandler, Consumer<io.grpc.stub.CallStreamObserver<OUT>> beforeStartHandler)
AbstractIncomingInstructionStream.clientId - the client identifier whom initiated this instruction streampermits - the number of permits this stream should receivepermitsBatch - the number of permits to be consumed prior to requesting new permitsdisconnectHandler - a Consumer of Throwable invoked when this stream errors outbeforeStartHandler - the handler to invoke when the upstream connection is available. Note that the gRPC
call has not started yet at this point.public void onNext(IN value)
protected abstract OUT buildAckMessage(InstructionAck ack)
OUT based on the given ack.ack - the InstructionAck to base the stream specific acknowledgement onOUT based on the given ackprotected Optional<OUT> buildResultMessage(InstructionResult result)
OUT based on the given result. If the
Optional is empty, no instruction result will be sent. By default, this method returns an empty
Optional. If the concrete class supports the InstructionResult it should override this method.result - the InstructionResult to base the stream specific acknowledgement onOUT based on the given resultprotected abstract String getInstructionId(IN instruction)
instruction.instruction - the instruction of type IN to retrieve the instruction identifier frominstructionprotected abstract InstructionHandler<IN,OUT> getHandler(IN msgIn)
InstructionHandler capable of handling the given msgIn.msgIn - the instruction message of type IN to retrieve an InstructionHandler onInstructionHandler capable of handling the given msgInpublic void onCompleted()
public void onError(Throwable t)
public void beforeStart(io.grpc.stub.ClientCallStreamObserver<OUT> requestStream)
beforeStart in interface io.grpc.stub.ClientResponseObserver<OUT,IN>beforeStart in class FlowControlledStream<IN,OUT>public io.grpc.stub.ClientCallStreamObserver<OUT> getInstructionsForPlatform()
StreamObserver of type OUT serving as the outbound instruction channel.StreamObserver of type OUT serving as the outbound instruction channelprotected abstract boolean unregisterOutboundStream(io.grpc.stub.CallStreamObserver<OUT> expected)
expected StreamObserver. Will return true if they matched and false otherwise.expected - the expected StreamObserver to be deregisteredtrue if the outbound stream was successfully deregistered, false otherwiseCopyright © 2020–2023 AxonIQ BV. All rights reserved.