/// <summary> /// Initializes a new instance of the <see cref="TransactionalOutboxBroker" /> class. /// </summary> /// <param name="queueWriter"> /// The <see cref="IOutboxWriter" /> to be used to write to the queue. /// </param> /// <param name="serviceProvider"> /// The <see cref="IServiceProvider" /> to be used to resolve the required services. /// </param> public TransactionalOutboxBroker( IOutboxWriter queueWriter, IServiceProvider serviceProvider) : base(serviceProvider) { _queueWriter = queueWriter; }
/// <summary> /// Initializes a new instance of the <see cref="OutboundQueueProducer" /> class. /// </summary> /// <param name="queueWriter"> /// The <see cref="IOutboxWriter" /> to be used to write to the queue. /// </param> /// <param name="broker"> /// The <see cref="IBroker" /> that instantiated this producer. /// </param> /// <param name="endpoint"> /// The endpoint to produce to. /// </param> /// <param name="behaviorsProvider"> /// The <see cref="IBrokerBehaviorsProvider{TBehavior}" />. /// </param> /// <param name="serviceProvider"> /// The <see cref="IServiceProvider" /> to be used to resolve the needed services. /// </param> /// <param name="logger"> /// The <see cref="ISilverbackIntegrationLogger" />. /// </param> public OutboundQueueProducer( IOutboxWriter queueWriter, TransactionalOutboxBroker broker, IProducerEndpoint endpoint, IBrokerBehaviorsProvider <IProducerBehavior> behaviorsProvider, IServiceProvider serviceProvider, ISilverbackIntegrationLogger <Producer> logger) : base(broker, endpoint, behaviorsProvider, serviceProvider, logger) { _queueWriter = queueWriter; }
public OutboxWorkerTests() { var serviceProvider = ServiceProviderHelper.GetServiceProvider( services => services .AddFakeLogger() .AddSilverback() .WithConnectionToMessageBroker( options => options .AddBroker <TestBroker>() .AddOutbox <InMemoryOutbox>() .AddOutboxWorker()) .AddEndpoints( endpoints => endpoints .AddOutbound <TestEventOne>(new TestProducerEndpoint("topic1")) .AddOutbound <TestEventTwo>(new TestProducerEndpoint("topic2")) .AddOutbound <TestEventThree>(new TestProducerEndpoint("topic3a")) .AddOutbound <TestEventThree>(new TestProducerEndpoint("topic3b")))); _broker = serviceProvider.GetRequiredService <TestBroker>(); _broker.ConnectAsync().Wait(); _worker = serviceProvider.GetRequiredService <IOutboxWorker>(); _outboxWriter = serviceProvider.GetRequiredService <IOutboxWriter>(); _sampleOutboundEnvelope = new OutboundEnvelope <TestEventOne>( new TestEventOne { Content = "Test" }, null, new TestProducerEndpoint("topic1")); _sampleOutboundEnvelope.RawMessage = AsyncHelper.RunValueTaskSynchronously( () => new JsonMessageSerializer().SerializeAsync( _sampleOutboundEnvelope.Message, _sampleOutboundEnvelope.Headers, MessageSerializationContext.Empty)); }
/// <summary> /// Initializes a new instance of the <see cref="OutboxTransactionManager" /> class. /// </summary> /// <param name="queueWriter"> /// The <see cref="OutboxTransactionManager" /> to manage. /// </param> public OutboxTransactionManager(IOutboxWriter queueWriter) { _queueWriter = queueWriter; }