Example #1
0
        public override async Task <Kernel> CreateKernelAsync(NamedPipeConnectionOptions options, KernelInvocationContext context)
        {
            var clientStream = new NamedPipeClientStream(
                ".",
                options.PipeName,
                PipeDirection.InOut,
                PipeOptions.Asynchronous, TokenImpersonationLevel.Impersonation);

            await clientStream.ConnectAsync();

            clientStream.ReadMode = PipeTransmissionMode.Message;
            var client      = clientStream.CreateKernelClient();
            var proxyKernel = new ProxyKernel(options.KernelName, client);

            proxyKernel.RegisterForDisposal(client);
            return(proxyKernel);
        }