Dkeshri.DataSync.DbChangeReceiver
1.0.4
See the version list below for details.
dotnet add package Dkeshri.DataSync.DbChangeReceiver --version 1.0.4
NuGet\Install-Package Dkeshri.DataSync.DbChangeReceiver -Version 1.0.4
<PackageReference Include="Dkeshri.DataSync.DbChangeReceiver" Version="1.0.4" />
paket add Dkeshri.DataSync.DbChangeReceiver --version 1.0.4
#r "nuget: Dkeshri.DataSync.DbChangeReceiver, 1.0.4"
// Install Dkeshri.DataSync.DbChangeReceiver as a Cake Addin #addin nuget:?package=Dkeshri.DataSync.DbChangeReceiver&version=1.0.4 // Install Dkeshri.DataSync.DbChangeReceiver as a Cake Tool #tool nuget:?package=Dkeshri.DataSync.DbChangeReceiver&version=1.0.4
Data-Sync-Receiver
This will subscribe to Message Broker like RabbitMq
Queue. On Message received, Apply changes to MSSQL
Database.
This package only support RabbitMQ
.
Installation Steps
Pre-requisite
Message Broker need to be running. (RabbitMq)
How to Use
This package is using the IServiceCollection
to setup. There is an Extension AddDbChangeReceiver
Method is use to setup.
you need to provide Message Broker Details (like rabbitMq) and MsSql Connection details to work this package.
Step 1
services.AddDbChangeReceiver((config) =>
{
config.AddRabbitMqBroker((rabbitMqConfig) =>
{
rabbitMqConfig.HostName = "RabbitMqhostName/IP";
rabbitMqConfig.Port = 5672;
rabbitMqConfig.QueueName = "DataSyncQueue";
rabbitMqConfig.UserName = "guest"; // user Name of RabbitMq
rabbitMqConfig.Password = "guest"; // password Name of RabbitMq
});
config.AddDataLayer((dbType, config) =>
{
dbType = DatabaseType.MSSQL;
config.ConnectionString = "Server=hostIP;Database=DatabaseName;User Id=userId;Password=DbPassword;Encrypt=False";
config.TransactionTimeOutInSec = 30;
});
});
**Step 2 😗*After Service Configuration call UseDbChangeReceiver
Extension Method of Ihost
var host = builder.UseConsoleLifetime().Build();
host.UseDbChangeReceiver();
Example:
Lets say we have .Net Core Console Application
, Use below code in Program.cs
file and run the application.
using Dkeshri.DataSync.DbChangeReceiver.Extenstions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices((hostContext, services) =>
{
services.AddDbChangeReceiver((config) =>
{
config.AddRabbitMqBroker((rabbitMqConfig) =>
{
rabbitMqConfig.HostName = "RabbitMqhostName/IP";
rabbitMqConfig.Port = 5672;
rabbitMqConfig.QueueName = "DataSyncQueue";
rabbitMqConfig.UserName = "guest"; // user Name of RabbitMq
rabbitMqConfig.Password = "guest"; // password Name of RabbitMq
});
config.AddDataLayer((dbType, config) =>
{
dbType = DatabaseType.MSSQL;
config.ConnectionString = "Server=hostIP;Database=DatabaseName;User Id=userId;Password=DbPassword;Encrypt=False";
config.TransactionTimeOutInSec = 30;
});
});
});
var host = builder.UseConsoleLifetime().Build();
host.UseDbChangeReceiver();
host.RunAsync().Wait();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Dkeshri.DataSync.Common (>= 1.0.4)
- Dkeshri.MessageQueue.RabbitMq (>= 1.0.0)
- MediatR (>= 12.4.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.