Expand description
MySQL replication with configuration-driven, committed event handlers.
use mysql_replication::{Event, Replication, Result, config::AppConfig};
use std::path::Path;
fn main() -> Result<()> {
let config = AppConfig::read(Path::new("cdc.toml"))?;
let mut replication = Replication::new(config)?;
replication.add_handle(|event: Event<'_>| {
for change in event.changes {
println!("{} {:?} {:?}", event.source_id, change.operation, change.pk);
}
Ok(())
});
replication.run()
}Re-exports§
pub use error::Error;pub use error::Result;pub use model::Change;pub use model::ColumnMeta;pub use model::Operation;pub use model::OwnedChange;pub use model::PrimaryKey;pub use model::TableMeta;pub use protocol::mysql::Decoder;pub use replication::Event;pub use replication::EventHandler;pub use replication::Replication;
Modules§
- config
- engine
- Source orchestration, transaction visibility and checkpoint persistence.
- error
- model
- Typed change records, primary keys and ordered table metadata.
- protocol
- Database-specific wire protocols and version adapters.
- replication
- Configuration-driven replication and committed event listeners.
- sink
- Transaction sink contract and output implementations.
- source
- Source plugin interfaces and registry; concrete transports live in submodules.