private void OnExecutionInterrupted(CurrentCommandCancelled currentCommandCancelled, Message request, IMessageSender serverChannel) { // reply var interruptReplyPayload = new InterruptReply(); // send to server var interruptReply = Message.CreateResponse( interruptReplyPayload, request); serverChannel.Send(interruptReply); }
private async Task HandleCancelCurrentCommand( CancelCurrentCommand cancelCurrentCommand, KernelInvocationContext context) { var reply = new CurrentCommandCancelled(cancelCurrentCommand); lock (_cancellationSourceLock) { _cancellationSource.Cancel(); _cancellationSource = new CancellationTokenSource(); } context.Publish(reply); }
private void OnExecutionInterrupted(CurrentCommandCancelled currentCommandCancelled) { if (InFlightRequests.TryRemove(currentCommandCancelled.Command, out var openRequest)) { // reply var interruptReplyPayload = new InterruptReply(); // send to server var interruptReply = Message.CreateResponse( interruptReplyPayload, openRequest.Context.Request); openRequest.Context.ServerChannel.Send(interruptReply); openRequest.Context.RequestHandlerStatus.SetAsIdle(); openRequest.Dispose(); } }