示例#1
0
        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="pipelineName">An optional pipeline name</param>
        public void Publish(object request, string?pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            try
            {
                if (pipelineName is string)
                {
                    var pipeline = _pipelines.GetPipeline(pipelineName);
                    pipeline.Publish(GetService, request !);
                }
                else
                {
                    var pipeline = _pipelines.GetPipeline(request.GetType());
                    pipeline.Publish(GetService, request !);
                }
            }
            catch (PipelineNotFoundException)
            {
                var e = new PipelineNotFoundEventArgs(request);
                OnPipelineNotFound(e);
            }
        }
示例#2
0
 /// <summary>
 /// On Pipeline Not Found.
 /// </summary>
 /// <param name="e">OnErrorEventArgs.</param>
 protected virtual void OnPipelineNotFound(PipelineNotFoundEventArgs e)
 {
     if (this.PipelineNotFound is EventHandler <PipelineNotFoundEventArgs> )
     {
         this.PipelineNotFound(this, e);
     }
 }