public OutboundRouterBehaviorTests() { var services = new ServiceCollection(); _testSubscriber = new TestSubscriber(); services.AddSilverback() .WithConnectionToMessageBroker( options => options .AddBroker <TestBroker>() .AddBroker <TestOtherBroker>()) .AddSingletonSubscriber(_testSubscriber); services .AddSingleton(Substitute.For <IHostApplicationLifetime>()) .AddLoggerSubstitute(); _serviceProvider = services.BuildServiceProvider(); _behavior = (OutboundRouterBehavior)_serviceProvider.GetServices <IBehavior>() .First(s => s is OutboundRouterBehavior); _routingConfiguration = (OutboundRoutingConfiguration)_serviceProvider .GetRequiredService <IOutboundRoutingConfiguration>(); _broker = _serviceProvider.GetRequiredService <TestBroker>(); _otherBroker = _serviceProvider.GetRequiredService <TestOtherBroker>(); }
/// <summary> /// Initializes a new instance of the <see cref="OutboundEndpointsHealthCheckService" /> class. /// </summary> /// <param name="outboundRoutingConfiguration"> /// The <see cref="IOutboundRoutingConfiguration" /> to be used to retrieve the list of outbound /// endpoints. /// </param> /// <param name="brokerCollection"> /// The collection containing the available brokers. /// </param> /// <param name="serviceProvider"> /// The <see cref="IServiceProvider" />. /// </param> public OutboundEndpointsHealthCheckService( IOutboundRoutingConfiguration outboundRoutingConfiguration, IBrokerCollection brokerCollection, IServiceProvider serviceProvider) { _outboundRoutingConfiguration = Check.NotNull( outboundRoutingConfiguration, nameof(outboundRoutingConfiguration)); _brokerCollection = Check.NotNull(brokerCollection, nameof(brokerCollection)); _serviceProvider = Check.NotNull(serviceProvider, nameof(serviceProvider)); }
/// <summary> /// Initializes a new instance of the <see cref="OutboxWorker" /> class. /// </summary> /// <param name="serviceScopeFactory"> /// The <see cref="IServiceScopeFactory" /> used to resolve the scoped types. /// </param> /// <param name="brokerCollection"> /// The collection containing the available brokers. /// </param> /// <param name="routingConfiguration"> /// The configured outbound routes. /// </param> /// <param name="logger"> /// The <see cref="IOutboundLogger{TCategoryName}" />. /// </param> /// <param name="enforceMessageOrder"> /// Specifies whether the messages must be produced in the same order as they were added to the queue. /// If set to <c>true</c> the message order will be ensured, retrying the same message until it can be /// successfully /// produced. /// </param> /// <param name="batchSize"> /// The number of messages to be loaded and processed at once. /// </param> public OutboxWorker( IServiceScopeFactory serviceScopeFactory, IBrokerCollection brokerCollection, IOutboundRoutingConfiguration routingConfiguration, IOutboundLogger <OutboxWorker> logger, bool enforceMessageOrder, int batchSize) { _serviceScopeFactory = serviceScopeFactory; _brokerCollection = brokerCollection; _logger = logger; _enforceMessageOrder = enforceMessageOrder; _batchSize = batchSize; _routingConfiguration = routingConfiguration; }
public OutboundEndpointsHealthCheckService(IOutboundRoutingConfiguration outboundRoutingConfiguration, IBroker broker) { _outboundRoutingConfiguration = outboundRoutingConfiguration ?? throw new ArgumentNullException(nameof(outboundRoutingConfiguration)); _broker = broker ?? throw new ArgumentNullException(nameof(broker)); }
public OutboundEnvelopeFactory(IOutboundRoutingConfiguration routingConfiguration) { _routingConfiguration = routingConfiguration; }
/// <summary> /// Initializes a new instance of the <see cref="OutboundRouterBehavior" /> class. /// </summary> /// <param name="serviceProvider"> /// The <see cref="IServiceProvider" />. /// </param> public OutboundRouterBehavior(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _routing = serviceProvider.GetRequiredService <IOutboundRoutingConfiguration>(); }
public OutboundConnectorRouter(IOutboundRoutingConfiguration routingConfiguration, IEnumerable <IOutboundConnector> outboundConnectors, IPublisher publisher) { _routing = routingConfiguration; _outboundConnectors = outboundConnectors; _publisher = publisher; }
public EndpointsConfigurationBuilder(IOutboundRoutingConfiguration outboundRoutingConfiguration, IEnumerable <IInboundConnector> inboundConnectors, ErrorPolicyBuilder errorPolicyBuilder) { _outboundRoutingConfiguration = outboundRoutingConfiguration; _inboundConnectors = inboundConnectors; _errorPolicyBuilder = errorPolicyBuilder; }