public void SendArticleInfoRequest(string tenantId) { foreach (IConverterStream stream in _converterStreamList) { if ((tenantId != stream.TenantID) && (!string.IsNullOrEmpty(tenantId))) { continue; } ArticleInfoRequest articleInfoRequest = new ArticleInfoRequest(stream) { ID = MessageId.Next, Source = _subscriberID, // default Destination = int.Parse(stream.Destination), }; articleInfoRequest.Articles = new Article[_articleList.Count]; for (int i = 0; i < _articleList.Count; ++i) { articleInfoRequest.Articles[i] = _articleList[i]; } stream.Write(articleInfoRequest); } }
private void Dialog_RequestReceived(Object sender, MessageReceivedEventArgs <ArticleInfoRequest> e) { ArticleInfoRequest request = e.Message; this.OnMessageReceived(request, () => { IArticleInfoRequestedProcessState processState = new ArticleInfoRequestedProcessState(this, request); this.ProcessStarted?.Invoke(this, new ProcessStartedEventArgs <IArticleInfoRequestedProcessState>(processState)); }); }
public async Task <IArticleInfoFinishedProcessState> StartProcessAsync(IEnumerable <ArticleInfoRequestArticle> articles, CancellationToken cancellationToken = default) { ArticleInfoRequest request = this.CreateRequest(articles); ArticleInfoResponse response = await this.SendRequestAsync(request, () => { return(this.Dialog.SendRequestAsync(request, cancellationToken)); }).ConfigureAwait(continueOnCapturedContext: false); return(new ArticleInfoFinishedProcessState(request, response)); }
public IArticleInfoFinishedProcessState StartProcess(IEnumerable <ArticleInfoRequestArticle> articles) { ArticleInfoRequest request = this.CreateRequest(articles); ArticleInfoResponse response = this.SendRequest(request, () => { return(this.Dialog.SendRequest(request)); }); return(new ArticleInfoFinishedProcessState(request, response)); }
/// <summary> /// Processes an incomming article info request. /// </summary> /// <param name="request">The request to be processed.</param> private void ProcessArticleInfoRequest(ArticleInfoRequest request) { // Set the underlying XmlObjectStream to send the response on when request.Finish() is called. lock (_syncLock) { if (_messageObjectStream == null) { return; } request.MessageObjectStream = _messageObjectStream; } // Raise the corresponding event. base.Raise("ArticleInfoRequested", _articleInfoRequested, this, request); }
protected void OnRequestReceived(ArticleInfoRequest request) { this.RequestReceived?.Invoke(this, new MessageReceivedEventArgs <ArticleInfoRequest>(request, this.DialogProvider)); }
public Task <ArticleInfoResponse> SendRequestAsync(ArticleInfoRequest request, CancellationToken cancellationToken = default) { return(base.SendRequestAsync <ArticleInfoRequest, ArticleInfoResponse>(request, cancellationToken)); }
public ArticleInfoResponse SendRequest(ArticleInfoRequest request) { return(base.SendRequest <ArticleInfoRequest, ArticleInfoResponse>(request)); }
public ArticleInfoRequestedProcessState(ArticleInfoWorkflow workflow, ArticleInfoRequest request) { this.Workflow = workflow; this.Request = request; }
public ArticleInfoFinishedProcessState(ArticleInfoRequest request, ArticleInfoResponse response) { this.Request = request; this.Response = response; }