示例#1
0
 public void Subscribe(string channel)
 {
     if (channels.Contains(channel))
     {
         return;
     }
     channels.Add(channel);
     socket.Subscribe(ESBClient.stringToByteArray(channel + "\t"));
 }
示例#2
0
        public Subscriber(string _connectionString, string _proxyGuid, string ESBClientGuid)
        {
            connectionString = _connectionString;
            buf = new byte[65536];

            ctx    = ZmqContext.Create();
            socket = ctx.CreateSocket(SocketType.SUB);
            var binGuid = ESBClient.stringToByteArray(ESBClientGuid);

            channels = new List <string>();
            //socket.SubscribeAll();
            //socket.Subscribe(ASCIIEncoding.ASCII.GetBytes(""));
            socket.Subscribe(binGuid);
            socket.Connect(connectionString);
            socket.ReceiveHighWatermark = 100000;
            socket.ReceiveBufferSize    = 256 * 1024;
        }