public DefaultEndpointCircuitBreaker(IPipelineTransport transport, ISerializer serializer, EndpointDefinition definitioin) { this.ErrorStrategy = new EndpointPostConsumeStrategy.ErrorEndpointPerEndpoint(transport, serializer, definitioin); this.RetryStrategy = new EndpointPostConsumeStrategy.RetryEndpointPerEndpoint(transport, serializer, definitioin); this.SuccessStrategy = new EndpointPostConsumeStrategy.NoSuccessStrategy(); this.MaximumMessageAge = 5; }
/// <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(); }
public ErrorEndpointPerEndpoint(IPipelineTransport transport, ISerializer serializer, EndpointDefinition endpointDefinition) { this.serializer = serializer; this.transport = transport; endpointWhereErrorOccured = endpointDefinition.EndpointName; errorPipelineName = endpointDefinition.PipelineName + ".Errors"; EndpointDefinition errorEndpoint = new EndpointDefinition(errorPipelineName, endpointWhereErrorOccured + ".Errors", null, endpointWhereErrorOccured); transport.EndpointFactory.CreateTopicEndpoint(errorEndpoint); }
/// <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; }
public RetryEndpointPerEndpoint(IPipelineTransport transport, ISerializer serializer, EndpointDefinition endpointDefinition) { this.serializer = serializer; this.transport = transport; endpointWhereErrorOccured = endpointDefinition.EndpointName; retryPipelineName = endpointDefinition.PipelineName + ".RetryScheduler"; Dictionary<string, object> headers = new Dictionary<string, object>(); headers.Add("x-dead-letter-exchange", endpointDefinition.PipelineName); headers.Add("x-message-ttl", 500); EndpointDefinition retryEndpoint = new EndpointDefinition(retryPipelineName, endpointWhereErrorOccured + ".Retry", headers, endpointWhereErrorOccured); transport.EndpointFactory.CreateTopicEndpoint(retryEndpoint); }
/// <summary> /// Initializes a new instance of the <see cref="PipelinePublisher{T}"/> class. /// </summary> /// <param name="transport">The transport.</param> /// <param name="serializer">The serializer.</param> public PipelinePublisher(IPipelineTransport transport, ISerializer serializer) { this.transport = transport; this.serializer = serializer; }