Ejemplo n.º 1
0
 public ClientFactory(string address)
 {
     _ctx = NetMQContext.Create();
     try
     {
         _frontendAddress = "inproc://demo-zmq";
         _sharedQueue     = new RouterDealerQueueDevice(_frontendAddress, address, ConnectionMode.Connect, _ctx);
     }
     catch
     {
         try
         {
             _ctx.Dispose();
         }
         catch
         {
         }
         throw;
     }
 }
Ejemplo n.º 2
0
        public RepServer(string address, int nodeCount)
        {
            _ctx = NetMQContext.Create();

            if (nodeCount == 1)
            {
                _serverSocket = new RepSocket[]
                {
                    new RepSocket(address, ConnectionMode.Bind, _ctx)
                };
            }
            else
            {
                string backendAddress = "inproc://repserver/cluster";
                _dealerDevice = new RouterDealerQueueDevice(address, backendAddress, ConnectionMode.Bind, _ctx);

                _serverSocket = new RepSocket[nodeCount];
                for (int i = 0; i < nodeCount; i++)
                {
                    _serverSocket[i] = new RepSocket(backendAddress, ConnectionMode.Connect, _ctx);
                }
            }
        }