Esempio n. 1
0
 public void publishEvent(string topic, int number, int interval)
 {
     for (int i = 1; i <= number; i++)
     {
         Message aux = new Message(topic, i.ToString());
         broker.publish(aux);
     }
 }
Esempio n. 2
0
        //chamada pelo Publisher
        public void publish(Message aux)
        {
            foreach (KeyValuePair<Subscriber, string> t in lstSubsTopic)
            {
                if (aux.Topic.Equals(t.Value))
                {
                    notify(t.Key, aux);
                }
            }

            //if metodo de routing == flooding
            foreach (var viz in lstVizinhos)
            {
                floodMsg(aux, this);
            }
        }
Esempio n. 3
0
        //chamada pelos brokers
        private void floodMsg(Message aux, Broker broker)
        {
            foreach (KeyValuePair<Subscriber, string> t in lstSubsTopic)
            {
                if (aux.Topic.Equals(t.Value))
                {
                    notify(t.Key, aux);
                }
            }

            List<Broker> lst = lstVizinhos;
            lst.Remove(broker);
            //propagar para os outros todos
            foreach (var viz in lst)
            {
                floodMsg(aux, this);
            }
        }
Esempio n. 4
0
 private void notify(Subscriber s, Message m)
 {
     s.entregaEvento(m);
 }
Esempio n. 5
0
 public void notify(Message m)
 {
     Console.WriteLine("@SubNotify received a notification on topic {0} ----> {1}", m.Topic,m.Content);
     LogInterface log = (LogInterface)Activator.GetObject(typeof(LogInterface), "tcp://localhost:8086/PuppetMasterLog");
     log.log(this.name, m.author, m.Topic, 0, "subscriber");
 }
Esempio n. 6
0
        public void publish(string number, string topic, string secs,int filter, int order)
        {
            string urlRemote = url.Substring(0, url.Length - 14);//retirar XXXX/publisher
            string myURL = urlRemote + myPort;

            Console.WriteLine("@MPMPubImplementatio - {0} publishing events, on topic {1}", myURL, topic);

            int port = 9000;
            int mult = Int32.Parse("" + site[site.Length - 1]);
            urlRemote += (port + (mult * 100) + 1).ToString() + "/";

            BrokerReceiveBroker pub = (BrokerReceiveBroker)Activator.GetObject(typeof(BrokerReceiveBroker), urlRemote + "BrokerCommunication");
            for (int i = 0; i < Int32.Parse(number); i++)
            {
                count = count + 1;
                Message maux = new Message(topic, i.ToString(), count, name);
                pub.receivePublication(maux, myURL,filter,order);

                LogInterface log = (LogInterface)Activator.GetObject(typeof(LogInterface), "tcp://localhost:8086/PuppetMasterLog");
                log.log(this.name, this.name, topic, 0, "publisher");

            }
        }
Esempio n. 7
0
 public void entregaEvento(Message m)
 {
     Console.WriteLine("O subscriber {0} recebeu uma msg no topico {1}, com conteudo {2}", this.Name, m.Topic, m.Content);
 }
Esempio n. 8
0
 private void notify(string s, Message m)
 {
     //s.entregaEvento(m);
 }