private void SendGetDataMessageToKnownServerNodes(DataRequestMessage requestMessage) { requestMessage.IsFromAServerNode = true; for (var i = 0; i < _knowedServerNodesConnectors.Count; i++) { requestMessage.IsLastKnownServerNode = i == _knowedServerNodesConnectors.Count - 1; _knowedServerNodesConnectors[i].SendMessage(requestMessage); } }
public ServerNodeConnectionManager(IPEndPoint ipEndPoint, DataRequestMessage dataRequestMessage) { _dataRequestMessage = dataRequestMessage; var tcpConnector = new TcpConnector(GetTcpSocket(ipEndPoint), new DefaultWireProtocol()); tcpConnector.StateChanged += OnStateChanged; tcpConnector.MessageReceived += OnMessageReceived; tcpConnector.StartAsync(); }
private void Handle(DataRequestMessage message) { if (Logger.IsTrace) { Logger.Trace($"{Session.RemoteNodeId} NDM received: datarequest"); } _providerService.StartSessionAsync(message.DataRequest, message.ConsumedUnits, this) .ContinueWith(t => { if (t.IsFaulted && Logger.IsError) { Logger.Error("There was an error within NDM subprotocol.", t.Exception); } }); }
private void OnMessageReceived(object sender, MessageReceivedEventArgs args) { if (args.Message.MessageTypeName == typeof(DataRequestMessage).Name) { _discoveredServers.Clear(); _dataRequestMessagge = (DataRequestMessage)args.Message; _discoveryService.DiscoverServerNodes(); SelectBestServerToConectAfter(_dataRequestMessagge.RequestTimeout).Start(); } if (args.Message.MessageTypeName == typeof(DataResponseMessage).Name) { _clientConnecionService.SendDataToClient(args.Message); } }
public void Handle(DataRequestMessage message) { var result = _dataService.GetAllMessages <Message>(message.Path); Sender.Tell(new DataResponseMessage(result)); }