public void ConfigureServices(IServiceCollection services) { services .AddDbContext <ExamplesDbContext>( options => options .UseSqlServer(SqlServerConnectionHelper.GetProducerConnectionString())) .AddSilverback() .UseModel() .UseDbContext <ExamplesDbContext>() .WithConnectionToMessageBroker( options => options .AddKafka() .AddOutboundConnector() .AddDbOutboundConnector() .AddDbOutboundWorker()) .AddEndpoints( endpoints => endpoints .AddOutbound <IntegrationEventA>( new KafkaProducerEndpoint("silverback-examples-events") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092" } }) .AddOutbound <IntegrationEventB, DeferredOutboundConnector>( new KafkaProducerEndpoint("silverback-examples-events") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092" } })); }
public void ConfigureServices(IServiceCollection services) { services .AddDbContext <ExamplesDbContext>( options => options .UseSqlServer(SqlServerConnectionHelper.GetProducerConnectionString())) .AddSilverback() .UseModel() .UseDbContext <ExamplesDbContext>() .AddDbDistributedLockManager() .WithConnectionToMessageBroker( options => options .AddKafka() .AddDbOutboundConnector() .AddDbOutboundWorker( new DistributedLockSettings( acquireRetryInterval: TimeSpan.FromSeconds(1), heartbeatTimeout: TimeSpan.FromSeconds(10), heartbeatInterval: TimeSpan.FromSeconds(1)))) .AddEndpoints( endpoints => endpoints .AddOutbound <IIntegrationEvent>( new KafkaProducerEndpoint("silverback-examples-events") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092" } })); Console.WriteLine("Starting OutboundWorker background process (press CTRL-C to stop)..."); }
public void ConfigureServices(IServiceCollection services) { services .AddDbContext <ExamplesDbContext>( options => options .UseSqlServer(SqlServerConnectionHelper.GetProducerConnectionString())) .AddSilverback() .UseModel() .UseDbContext <ExamplesDbContext>() .WithConnectionToMessageBroker( options => options .AddRabbit() .AddDbOutboundConnector() .AddDbOutboundWorker()) .AddSingletonBehavior <CustomHeadersBehavior>() .AddEndpoints( endpoints => endpoints .AddOutbound <IIntegrationEvent>( new RabbitExchangeProducerEndpoint("silverback-examples-events-fanout") { Exchange = new RabbitExchangeConfig { IsDurable = true, IsAutoDeleteEnabled = false, ExchangeType = ExchangeType.Fanout }, Connection = new RabbitConnectionConfig { HostName = "localhost", UserName = "******", Password = "******" } })); }
public void ConfigureServices(IServiceCollection services) { services .AddDbContext <ExamplesDbContext>( options => options .UseSqlServer(SqlServerConnectionHelper.GetProducerConnectionString())) .AddSilverback() .UseModel() .UseDbContext <ExamplesDbContext>() .WithConnectionToMessageBroker( options => options .AddKafka() .AddDbOutboundConnector() .AddDbOutboundWorker()) .AddEndpoints( endpoints => endpoints .AddOutbound <IIntegrationEvent>( new KafkaProducerEndpoint("silverback-examples-events") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092", MessageTimeoutMs = 1000 } }) .AddOutbound <IIntegrationEvent>( new KafkaProducerEndpoint("silverback-examples-events-two") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092", MessageTimeoutMs = 1000 } }) .AddOutbound <IIntegrationEvent>( new KafkaProducerEndpoint("silverback-examples-failure") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://somwhere:1000", MessageTimeoutMs = 1000 } })); services .AddHealthChecks() .AddOutboundQueueCheck(); }
public void ConfigureServices(IServiceCollection services) { services .AddDbContext <ExamplesDbContext>( options => options .UseSqlServer(SqlServerConnectionHelper.GetProducerConnectionString())) .AddSilverback() .UseModel() .UseDbContext <ExamplesDbContext>() .AddDbDistributedLockManager() .WithConnectionToMessageBroker( options => options .AddRabbit() .AddDbOutboundConnector() .AddDbOutboundWorker( new DistributedLockSettings( acquireRetryInterval: TimeSpan.FromSeconds(1), heartbeatTimeout: TimeSpan.FromSeconds(10), heartbeatInterval: TimeSpan.FromSeconds(1)))) .AddEndpoints( endpoints => endpoints .AddOutbound <IIntegrationEvent>( new RabbitExchangeProducerEndpoint("silverback-examples-events-fanout") { Exchange = new RabbitExchangeConfig { IsDurable = true, IsAutoDeleteEnabled = false, ExchangeType = ExchangeType.Fanout }, Connection = new RabbitConnectionConfig { HostName = "localhost", UserName = "******", Password = "******" } })); Console.WriteLine("Starting OutboundWorker background process (press CTRL-C to stop)..."); }