Exemplo n.º 1
0
 public FilterPipelineElementTest()
 {
     _pipelineElement = new FilterPipelineElement(_mockNext.Object)
     {
         Log = _mockLog.Object
     };
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create the Submit Pipeline. The submit pipeline can be customized
        /// with custom submit pipeline elements to control the submission
        /// behaviour. The submit pipeline is stateless, so there is only one
        /// instance of each pipeline that is shared across all submissions.
        /// </summary>
        private void CreateSubmitPipeline()
        {
            var apiClientFactory = new ApiClientFactory();

            var httpSubmitItemElement = new HttpSubmitItemPipelineElement(null);

            httpSubmitItemElement.ApiClientFactory = apiClientFactory;

            // Create a Filter pipeline element for items. This implements the logic
            // to apply the user-defined filtering on item submission.
            // Pass the httpSubmitItemElement into the FilterPipelineElement to create a chain of pipeline elements.
            // The filter is called first, followed by the submission element.
            var itemFilterPipelineElement = new FilterPipelineElement(httpSubmitItemElement);

            _itemSubmitPipeline = itemFilterPipelineElement;

            var httpSubmitAggregationElement = new HttpSubmitAggregationPipelineElement(null);

            httpSubmitAggregationElement.ApiClientFactory = apiClientFactory;

            var aggregationFilterPipelineElement = new FilterPipelineElement(httpSubmitAggregationElement);

            _aggregationSubmitPipeline = aggregationFilterPipelineElement;

            var circuitBreakerOpts      = new CircuitBreakerOptions();
            var httpSubmitBinaryElement = new DirectSubmitBinaryPipelineElement(null)
            {
                ApiClientFactory = apiClientFactory,
                CircuitProvider  = new AzureBlobRetryProviderWithCircuitBreaker(circuitBreakerOpts, true),
                RetryProvider    = new AzureBlobRetryProviderWithCircuitBreaker(circuitBreakerOpts, true),
                // Log = optional logger
            };

            var binaryFilterPipelineElement = new FilterPipelineElement(httpSubmitBinaryElement);

            _binarySubmitPipeline = binaryFilterPipelineElement;

            var httpSubmitAuditEventElement = new HttpSubmitAuditEventPipelineElement(null);

            httpSubmitAuditEventElement.ApiClientFactory = apiClientFactory;
            _auditEventSubmitPipeline = httpSubmitAuditEventElement;
        }