Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private async Task HandleCancelCurrentCommand(
            CancelCurrentCommand cancelCurrentCommand,
            KernelInvocationContext context)
        {
            var reply = new CurrentCommandCancelled(cancelCurrentCommand);

            lock (_cancellationSourceLock)
            {
                _cancellationSource.Cancel();
                _cancellationSource = new CancellationTokenSource();
            }

            context.Publish(reply);
        }
Esempio n. 3
0
        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();
            }
        }