private bool WaitMessageArriveBackFromRedis(FarmMessage message) { var locker = lockers[message.Id.ToString()]; var res = locker.WaitOne(WAIT_TIME); lockers.Remove(message.Id.ToString()); return(res); }
public void PublishSync(FarmMessage message) { CreateLockerForApp(message); Publish(message); var res = WaitMessageArriveBackFromRedis(message); // todo: if res false if (!res) { throw new PublishSyncTimeoutException(); } }
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, ""); } }
private void HandleMessage(FarmMessage message) { throw new NotImplementedException(); }
private void CreateLockerForApp(FarmMessage message) { var currentAppLocker = new ManualResetEvent(false); lockers[message.Id.ToString()] = currentAppLocker; }