private Exception removeSubscription(string guid, out SubRecord subRec) { lock (_token) { if (_subs.TryGetValue(guid, out subRec)) { _subs.Remove(guid); return(null); } } return(new ApplicationException(string.Format("nats subscription not found. guid='{0}'", guid))); }
public string QueueSubscribe(string subject, string queue, StanSubscriptionOptions options, EventHandler <StanMsgHandlerArgs> cb) { IStanSubscription sub = null; string guid = Guid.NewGuid().ToString(); var error = internalSubscribe(subject, queue, options, cb, out sub); // keep a copy of subscription info _subs[guid] = new SubRecord { subject = subject, queue = queue, options = options, cb = cb, sub = sub, }; if (error != null) { internalClose(); reconnect(); } // return return(guid); }