예제 #1
0
        public Shell(
            IKernel kernel,
            ICommandScheduler <JupyterRequestContext> scheduler,
            ConnectionInformation connectionInformation)
        {
            if (connectionInformation == null)
            {
                throw new ArgumentNullException(nameof(connectionInformation));
            }

            _kernel    = kernel ?? throw new ArgumentNullException(nameof(kernel));
            _scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler));

            _shellAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.ShellPort}";
            _ioPubAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.IOPubPort}";
            _stdInAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.StdinPort}";
            _controlAddress = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.ControlPort}";

            var signatureAlgorithm = connectionInformation.SignatureScheme.Replace("-", string.Empty).ToUpperInvariant();

            _signatureValidator = new SignatureValidator(connectionInformation.Key, signatureAlgorithm);
            _shell       = new RouterSocket();
            _ioPubSocket = new PublisherSocket();
            _stdIn       = new RouterSocket();
            _control     = new RouterSocket();

            _shellChannel = new ReplyChannel(new MessageSender(_shell, _signatureValidator));
            _ioPubChannel = new PubSubChannel(new MessageSender(_ioPubSocket, _signatureValidator));
            _stdInChannel = new StdInChannel(new MessageSender(_stdIn, _signatureValidator), new MessageReceiver(_stdIn));

            _disposables = new CompositeDisposable
            {
                _shell,
                _ioPubSocket,
                _stdIn,
                _control
            };
        }
예제 #2
0
 public SummatorMessage(int[] args, ReplyChannel <int> replyChannel)
 {
     Args         = args;
     ReplyChannel = replyChannel;
 }
예제 #3
0
 internal JupyterRequestContext(ReplyChannel serverChannel, PubSubChannel ioPubChannel, Envelope
                                request, string kernelIdentity) :
     this(new JupyterMessageSender(ioPubChannel, serverChannel, kernelIdentity, request), request, kernelIdentity)
 {
 }
예제 #4
0
        protected override async Task HandleMessage(ReplyChannel <int> msg)
        {
            await Task.Delay(500);

            msg.Reply(_random.Next(100, 500));
        }
예제 #5
0
 public TimeoutBeeMsg(ReplyChannel <Unit> replyChannel)
 {
     ReplyChannel = replyChannel;
 }
예제 #6
0
 internal JupyterRequestContext(ReplyChannel serverChannel, PubSubChannel ioPubChannel, StdInChannel stdInChannel, ZeroMQMessage request, string kernelIdentity)
     : this(new JupyterMessageSender(ioPubChannel, serverChannel, stdInChannel, kernelIdentity, request), request)
 {
 }
예제 #7
0
 public Add(ReplyChannel <int> value)
 {
     this.Value = value;
 }