コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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));
            });
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
ファイル: ArticleInfoDialog.cs プロジェクト: ThomasReth/ITSS2
 protected void OnRequestReceived(ArticleInfoRequest request)
 {
     this.RequestReceived?.Invoke(this, new MessageReceivedEventArgs <ArticleInfoRequest>(request, this.DialogProvider));
 }
コード例 #7
0
ファイル: ArticleInfoDialog.cs プロジェクト: ThomasReth/ITSS2
 public Task <ArticleInfoResponse> SendRequestAsync(ArticleInfoRequest request, CancellationToken cancellationToken = default)
 {
     return(base.SendRequestAsync <ArticleInfoRequest, ArticleInfoResponse>(request, cancellationToken));
 }
コード例 #8
0
ファイル: ArticleInfoDialog.cs プロジェクト: ThomasReth/ITSS2
 public ArticleInfoResponse SendRequest(ArticleInfoRequest request)
 {
     return(base.SendRequest <ArticleInfoRequest, ArticleInfoResponse>(request));
 }
コード例 #9
0
 public ArticleInfoRequestedProcessState(ArticleInfoWorkflow workflow, ArticleInfoRequest request)
 {
     this.Workflow = workflow;
     this.Request  = request;
 }
コード例 #10
0
 public ArticleInfoFinishedProcessState(ArticleInfoRequest request, ArticleInfoResponse response)
 {
     this.Request  = request;
     this.Response = response;
 }