/// <summary> /// Publish a message received over the connection /// /// If the connection is subscribing to the topic the message is published /// to it will receive the message back. /// </summary> /// <param name="data"></param> private void ProcessMessage(IDictionary <string, object> data) { // Must be authenticated to send messages if (!m_authenticated) { return; } // Make sure the data is valid ITopic topic = m_messagebus.Create(data[MessageTopic].ToString()); if (topic == null) { return; } // Create the message IDictionary <string, object> message = data[MessagePayload] as IDictionary <string, object>; if (message == null) { return; } // Convert to a message instance and send lock (m_builder) { m_builder.Clear(); foreach (string key in message.Keys) { m_builder.Add(key, message[key]); } m_messagebus.Publish(topic, m_builder.CreateMessage()); } }
public void SetUp() { _busControl = Substitute.For <IBusControl>(); _messageBus = Substitute.For <IMessageBus>(); _messageBus.Create().Returns(_busControl); _tabCommandService = new TabCommandService(_messageBus); }
public ITopic Create(string topic) { return(m_messageBus.Create(topic)); }
public void Start() { _busControl = _messageBus.Create(); _busControl.Start(); }