/// <summary> /// Creates an instace of <see cref="InboxSubscription"/> /// </summary> /// <param name="owner"></param> /// <param name="sid"></param> /// <param name="subject"></param> /// <param name="feedback"></param> internal InboxSubscription( SubscriptionPool owner, long sid, string subject, IRequestReplayFeedback feedback ) : base(owner, sid, subject, queue: string.Empty, useCache: false) { this._feedback = feedback; }
/// <summary> /// Entry-point to register a special INBOX subscription /// internally used for the request-reply mechanism. /// </summary> /// <param name="subject">The subject to subscribe to.</param> /// <param name="feedback">The reference to the reply message handler.</param> /// <returns>An instance of <see cref="InboxSubscription"/>.</returns> internal InboxSubscription SubscribeInbox( string subject, IRequestReplayFeedback feedback ) { lock (this._sublocker) { //creates a new instance of subscription proxy this._ssid++; var sub = new InboxSubscription(this, this._ssid, subject, feedback); //then register it this._subRegister.Add(this._ssid, sub); //finally, enqueues the request of subscription to be //sent to the NATS broker. this._connmgr.EnqueueSubscriptionOperation(sub.ProtoMessageSub); return(sub); } }