/// <summary> /// Initializes a new instance of the ResponseCallbackItem class. /// </summary> /// <param name="callback">the response callback.</param> /// <param name="filter">the filter for the responses.</param> /// <param name="expectResponseCount">the expected responses count that should returned through this callback.</param> /// <param name="callbackState">the callback state object.</param> /// <param name="needRemove">a value indicating whether need remove the fetched responses.</param> public ResponseCallbackItem(BrokerQueueCallback callback, MessageVersion messageVersion, ResponseActionFilter filter, long expectResponseCount, object callbackState) { if (callback == null) { throw new ArgumentNullException("callback"); } this.responsesCallbackField = callback; this.messageVersionField = messageVersion; this.responseFilterField = filter; this.expectedResponsesCountField = expectResponseCount; this.callbackStateField = callbackState; }
/// <summary> /// register a response call back to get the response message. /// </summary> /// <param name="responseCallback">the response callback, the async result should be the BrokerQueueItem</param> /// <param name="messageVersion">the message version for the response message. if failed to pull the response from the storage, will use this version to create a fault message.</param> /// <param name="filter">the filter for the responses that the response callback expected.</param> /// <param name="responseCount">the responses count this registered response callback want to get.</param> /// <param name="state">the state object for the callback</param> /// <returns>a value indicating whether the response callback is registered sucessfully.</returns> public abstract bool RegisterResponsesCallback(BrokerQueueCallback responseCallback, MessageVersion messageVersion, ResponseActionFilter filter, int responseCount, object state);