Пример #1
0
 public PipelineConsumerWork(SubscriptionMiddleware subscriptions, IEndpoint endpoint, ISerializer serializer, MessageThreshold messageThreshold)
 {
     this.endpoint         = endpoint;
     this.subscriptions    = subscriptions;
     this.serializer       = serializer;
     this.messageThreshold = messageThreshold;
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EndpointConsumer"/> class.
        /// </summary>
        /// <param name="transport">The transport.</param>
        /// <param name="serializer">The serializer.</param>
        /// <param name="messageThreshold">The message threshold.</param>
        public EndpointConsumer(string name, IPipelineTransport transport, SubscriptionMiddleware subscriptions, ISerializer serializer, MessageThreshold messageThreshold = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Invalid consumer name", nameof(name));
            }
            if (ReferenceEquals(null, transport))
            {
                throw new ArgumentNullException(nameof(transport));
            }
            if (ReferenceEquals(null, subscriptions))
            {
                throw new ArgumentNullException(nameof(subscriptions));
            }
            if (subscriptions.Subscribers.Count() == 0)
            {
                throw new ArgumentException("A consumer must have at least one subscriber to work properly.", nameof(subscriptions));
            }
            if (ReferenceEquals(null, serializer))
            {
                throw new ArgumentNullException(nameof(serializer));
            }

            this.Name          = name;
            NumberOfWorkers    = 1;
            this.subscriptions = subscriptions;
            this.transport     = transport;
            this.serializer    = serializer;
            pools = new List <WorkPool>();
            this.messageThreshold = messageThreshold ?? new MessageThreshold();
        }
Пример #3
0
 public PipelineConsumerWork(IMessageProcessor processor, IEndpoint endpoint, ISerializer serializer, MessageThreshold messageThreshold, IEndpointCircuitBreaker circuitBreaker)
 {
     this.endpoint = endpoint;
     this.processor = processor;
     this.circuitBreaker = circuitBreaker;
     this.serializer = serializer;
     this.messageThreshold = messageThreshold ?? new MessageThreshold();
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EndpointConsumer{TContract}"/> class.
 /// </summary>
 /// <param name="transport">The transport.</param>
 /// <param name="messageProcessor">The message processor.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="messageThreshold">The message threshold.</param>
 /// <param name="circuitBreakerFactory">The circuit breaker factory.</param>
 public EndpointConsumer(IPipelineTransport transport, IMessageProcessor messageProcessor, ISerializer serializer, MessageThreshold messageThreshold, IEndpontCircuitBreakerFactrory circuitBreakerFactory)
 {
     NumberOfWorkers = 1;
     this.messageProcessor = messageProcessor;
     this.transport = transport;
     pools = new List<WorkPool>();
     this.serializer = serializer;
     this.messageThreshold = messageThreshold;
     this.circuitBreakerFactory = circuitBreakerFactory;
 }