|
| 1 | +# SciSharp.MySQL.Replication 1.0.0-beta.3 |
| 2 | + |
| 3 | +## Overview |
| 4 | +SciSharp.MySQL.Replication is a C# implementation of the MySQL replication protocol client. This library allows you to receive events like insert, update, delete with their data and raw SQL queries directly from MySQL. |
| 5 | + |
| 6 | +## What's New in 1.0.0-beta.3 |
| 7 | +- Added support for .NET 9.0 |
| 8 | +- Improved handling of binary log events |
| 9 | +- Enhanced parsing of JSON type data |
| 10 | +- Fixed issues with timestamp conversion |
| 11 | +- Performance improvements for large data sets |
| 12 | +- Better error handling and reporting |
| 13 | +- Updated dependencies to latest stable versions |
| 14 | + |
| 15 | +## Key Features |
| 16 | +- Connect to MySQL server as a replica |
| 17 | +- Parse and process binary log events in real-time |
| 18 | +- Support for all MySQL data types including JSON, BLOB, TEXT, etc. |
| 19 | +- Handle various events including: |
| 20 | + - Query events (raw SQL statements) |
| 21 | + - Table maps |
| 22 | + - Row events (insert, update, delete) |
| 23 | + - Format description events |
| 24 | + - Rotate events |
| 25 | + - XID events (transaction identifiers) |
| 26 | +- Checksum verification support |
| 27 | +- Built-in support for MySQL binary format parsing |
| 28 | +- Async/await first design |
| 29 | + |
| 30 | +## Requirements |
| 31 | +- .NET 6.0+ or higher |
| 32 | +- MySQL server with binary logging enabled |
| 33 | +- MySQL user with replication privileges |
| 34 | + |
| 35 | +## Getting Started |
| 36 | +```csharp |
| 37 | +using SciSharp.MySQL.Replication; |
| 38 | + |
| 39 | +var serverHost = "localhost"; |
| 40 | +var username = "root"; |
| 41 | +var password = "your_password"; |
| 42 | +var serverId = 1; // replication server id |
| 43 | +
|
| 44 | +var client = new ReplicationClient(); |
| 45 | +var result = await client.ConnectAsync(serverHost, username, password, serverId); |
| 46 | + |
| 47 | +if (!result.Result) |
| 48 | +{ |
| 49 | + Console.WriteLine($"Failed to connect: {result.Message}."); |
| 50 | + return; |
| 51 | +} |
| 52 | + |
| 53 | +client.PackageHandler += (s, p) => |
| 54 | +{ |
| 55 | + Console.WriteLine(p.ToString()); |
| 56 | + Console.WriteLine(); |
| 57 | +} |
| 58 | + |
| 59 | +client.StartReceive(); |
| 60 | + |
| 61 | +// Keep your application running to receive events |
| 62 | +// ... |
| 63 | +
|
| 64 | +await client.CloseAsync(); |
| 65 | +``` |
| 66 | + |
| 67 | +For more detailed documentation and examples, please visit our [GitHub repository](https://github.com/SciSharp/dotnet-mysql-replication). |
0 commit comments