public static List<ClientConnection> GetSubscribers(Message msg, IList<ClientConnection> clients) { var delimiter = '.'; var result = new List<ClientConnection>(); var topicStack = TopicRouter.ConvertToStack(msg.Topic, delimiter); foreach (var client in clients) { foreach (var subStack in client.TopicStack) { if (MatchTopic(topicStack.Clone(), subStack, false)) { //Add client to subscription list result.Add(client); break; } } } // duga.sde.hde13cb.010.datastorage.1.error.exception.resource already defined // duga.sde.hde13cb.010.datastorage.1.error // duga.#.error // duga.sde.*.*.datastorage.*.error return result; }
private void btnStartEmulation_Click(object sender, EventArgs e) { try { int cnt = Convert.ToInt32(tbxSendCount.Text); for (int i = 0; i < cnt; i++) { var msg = new MessageRouting.Shared.Model.Message { Topic = tbxTopicEmulation.Text.Replace("[0]", i.ToString()), Text = tbxMessageEmulation.Text.Replace("[0]", i.ToString()), Level = tbxLevelEmulation.Text.Replace("[0]", i.ToString()) }; Publiser.Publish(msg); lblEmulationStats.Text = string.Format("Stats: \r\n # {0}", i); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void bntPublish_Click(object sender, EventArgs e) { var msg = new MessageRouting.Shared.Model.Message { Topic = tbxTopic.Text, Text = tbxMessage.Text, Level = tbxLevel.Text }; Publiser.Publish(msg); }
public void Publish(Message msg) { try { if (connection.State == ConnectionState.Connected) { PublisherHubProxy.Invoke("Publish", msg); } } catch (Exception ex) { LogConnectionInformation("", ex); } }