/// <summary> /// Handles the incoming GeneralGroupCommunicationMessage sent to this Communication Group. /// Looks for the operator that the message is being sent to and invoke its handler. /// </summary> /// <param name="message">The incoming message</param> public void OnNext(GeneralGroupCommunicationMessage message) { string operatorName = message.OperatorName; IObserver<GeneralGroupCommunicationMessage> handler = GetOperatorHandler(operatorName); if (handler == null) { Exceptions.Throw(new ArgumentException("No handler registered with the operator name: " + operatorName), LOGGER); } else { handler.OnNext(message); } }
/// <summary> /// Send the GroupCommunicationMessage to the Task whose name is /// included in the message. /// </summary> /// <param name="message">The message to send.</param> internal void Send(GeneralGroupCommunicationMessage message) { if (message == null) { throw new ArgumentNullException("message"); } if (string.IsNullOrEmpty(message.Destination)) { throw new ArgumentException("Message destination cannot be null or empty"); } IIdentifier destId = _idFactory.Create(message.Destination); var conn = _networkService.NewConnection(destId); conn.Open(); conn.Write(message); }