private void PublishError(Message request, PublisherSocket ioPub, IErrorResult error) { // Write to Stderr first -- then write the ExecuteError var errorMessage = new StderrContent(error.Message); Message message = new Message(MessageType.Stream, errorMessage, request.Header) { Identifiers = request.Identifiers }; this._logger.LogInformation(string.Format("Sending message to IOPub {0}", JsonConvert.SerializeObject(message))); ioPub.SendMessage(message); var executeReply = new ExecuteErrorPublishContent() { ExecutionCount = _executionCount, EName = error.Name, EValue = error.Message, Traceback = error.StackTrace }; message = new Message(MessageType.Error, executeReply, request.Header) { Identifiers = request.Identifiers }; this._logger.LogInformation(string.Format("Sending message to IOPub {0}", JsonConvert.SerializeObject(message))); ioPub.SendMessage(message); }
public void PublishInput(Message request, PublisherSocket ioPub, string code) { var content = new ExecuteRequestPublishContent(code, _executionCount); Message message = new Message(MessageType.Input, content, request.Header); this._logger.LogInformation(string.Format("Sending message to IOPub {0}", JsonConvert.SerializeObject(message))); ioPub.SendMessage(message); }
public void PublishOutput(Message request, PublisherSocket ioPub, DisplayDataContent data) { var content = new ExecuteResultPublishContent(data, _executionCount); Message message = new Message(MessageType.ExecuteResult, content, request.Header); this._logger.LogInformation(string.Format("Sending message to IOPub {0}", JsonConvert.SerializeObject(message))); ioPub.SendMessage(message); }
public void PublishStatus(Message request, PublisherSocket ioPub, KernelState statusValue) { Message message = new Message(MessageType.Status, new StatusContent(statusValue), request.Header); this._logger.LogInformation(string.Format("Sending message to IOPub {0}", JsonConvert.SerializeObject(message))); ioPub.SendMessage(message); this._logger.LogInformation("Message Sent"); }
protected override void ConsumerAction() { using (NetMQContext ctx = NetMQContext.Create()) { using (PublisherSocket socket = ctx.CreatePublisherSocket()) { socket.Bind(Address); foreach (NetMQMessage message in Queue.GetConsumingEnumerable()) { socket.SendMessage(message); } } } }
public void SendMessage(SerializedMessage message) => PublisherSocket.SendMessage(message);