Пример #1
0
 public Model(IUdpCommunication udpComm, int listenPort, string ip, int brokerPort)
 {
     _listenPort           = listenPort;
     _comm                 = udpComm;
     consumers             = new List <Tuple <IBasicConsumer, string> >();
     _comm.PublishPackage += OnMessageReceived;
     _comm.Listen(listenPort);
     _comm.SetBrokerInformation(ip, brokerPort);
 }
Пример #2
0
 private static void Initialize()
 {
     Debug.WriteLine("Initializing HarakaMQ");
     Setup.Initialize();
     _udpCommunication = Setup.container.GetInstance <IUdpCommunication>();
     _udpCommunication.SetUpUdpComponent(10, 2000, false, Setup.container.GetInstance <IJsonConfigurator>().GetSettings().Brokers.Select(x => x.Ipaddress + x.Port).ToArray());
     _udpCommunication.QueueDeclare       += QueueDeclareMessageRecieved;
     _udpCommunication.PublishPackage     += PublishMessageRecieved;
     _udpCommunication.Subscribe          += SubsribeMessageRecieved;
     _udpCommunication.AntiEntropyMessage += AntiEntropyMessageMessageReceived;
     _udpCommunication.Listen(Setup.container.GetInstance <IJsonConfigurator>().GetSettings().BrokerPort);
     _gossip = Setup.container.GetInstance <IGossip>();
     _gossip.StartGossip();
 }