コード例 #1
0
        private bool WaitMessageArriveBackFromRedis(FarmMessage message)
        {
            var locker = lockers[message.Id.ToString()];
            var res    = locker.WaitOne(WAIT_TIME);

            lockers.Remove(message.Id.ToString());
            return(res);
        }
コード例 #2
0
        public void PublishSync(FarmMessage message)
        {
            CreateLockerForApp(message);
            Publish(message);
            var res = WaitMessageArriveBackFromRedis(message);

            // todo: if res false
            if (!res)
            {
                throw new PublishSyncTimeoutException();
            }
        }
コード例 #3
0
        public void Publish(FarmMessage message)
        {
            PublishCount++;
            var wrappedMessage = new FarmMessageWrapper {
                Message = message, SenderId = this.SubscriberID
            };
            var str = JsonConvert.SerializeObject(wrappedMessage);

            try
            {
                subscriber.Publish(this.roomName, str);
            }
            catch (Exception exception)
            {
                Maps.Instance.DuradosMap.Logger.Log("RedisFarmTransport", "Publish", "", exception, 1, "");
            }
        }
コード例 #4
0
 private void HandleMessage(FarmMessage message)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
        private void CreateLockerForApp(FarmMessage message)
        {
            var currentAppLocker = new ManualResetEvent(false);

            lockers[message.Id.ToString()] = currentAppLocker;
        }