/// <summary> /// This method stops the outgoing request supports and marks any pending jobs as cancelled. /// </summary> protected virtual void OutgoingRequestsTearDown() { //Remove the filter for the message. CommandUnregister(ResponseId, false); //Unregister the time out schedule. if (mScheduleTimeout != null) { Scheduler.Unregister(mScheduleTimeout); mScheduleTimeout = null; } try { foreach (var key in mOutgoingRequests.Keys.ToList()) { OutgoingRequestTimeout(key); } mOutgoingRequests.Clear(); mOutgoingRequests = null; } catch (Exception ex) { Collector?.LogException("OutgoingRequestsStop error", ex); } }
/// <summary> /// This method starts the outgoing request support. /// </summary> protected virtual void OutgoingRequestsInitialise() { mOutgoingRequests = new ConcurrentDictionary <string, OutgoingRequestTracker>(); //Set a timer to signal timeout requests mScheduleTimeout = new CommandTimeoutSchedule(TimeOutScheduler , mPolicy.OutgoingRequestsTimeoutPoll , string.Format("{0} Command OutgoingRequests Timeout Poll", FriendlyName)); Scheduler.Register(mScheduleTimeout); //Check whether the ResponseId has been set, and if not then raise an error //as outgoing messages will not work without a return path. if (ResponseId == null) { throw new CommandStartupException($"Command={GetType().Name}: Outgoing requests are enabled, but the ResponseId parameter has not been set"); } //This is the return message handler CommandRegister(ResponseId, OutgoingRequestResponseIn); }
/// <summary> /// This method stops the outgoing request supports and marks any pending jobs as cancelled. /// </summary> protected virtual void OutgoingRequestsTimeoutStop() { if (mScheduleTimeout != null) { Scheduler.Unregister(mScheduleTimeout); mScheduleTimeout = null; } try { foreach (var key in mOutgoingRequests.Keys.ToList()) { OutgoingRequestRemove(key, null); } mOutgoingRequests.Clear(); mOutgoingRequests = null; } catch (Exception ex) { } }
/// <summary> /// This method starts the outgoing request support. /// </summary> protected virtual void OutgoingRequestsInitialise() { mOutgoingRequests = new ConcurrentDictionary <string, OutgoingRequestTracker>(); //Set a timer for aborted requests if the Task if (!TaskManagerTimeoutSupported) { mScheduleTimeout = new CommandTimeoutSchedule(OutgoingRequestsProcessTimeouts, mPolicy.OutgoingRequestsTimeoutPoll, string.Format("{0} Command OutgoingRequests Timeout Poll", FriendlyName)); Scheduler.Register(mScheduleTimeout); } //Check whether the ResponseId has been set, and if so then register the command. if (ResponseId == null) { throw new CommandStartupException("Outgoing requests are enabled, but the ResponseId parameter has not been set"); } //This is the return message handler CommandRegister(ResponseId, OutgoingRequestResponseProcess); }
/// <summary> /// This method stops the outgoing request supports and marks any pending jobs as cancelled. /// </summary> protected virtual void OutgoingRequestsStop() { //Unregister the time out schedule. if (mScheduleTimeout != null) { Scheduler.Unregister(mScheduleTimeout); mScheduleTimeout = null; } try { foreach (var key in mOutgoingRequests.Keys.ToList()) { OutgoingRequestTimeout(key); } mOutgoingRequests.Clear(); mOutgoingRequests = null; } catch (Exception ex) { Collector?.LogException("OutgoingRequestsStop error", ex); } }