run_cdc_app

Function run_cdc_app 

Source
pub async fn run_cdc_app(
    config: Config,
    lsn_file_path: Option<&str>,
) -> CdcResult<()>
Expand description

High-level convenience function to run CDC application with configuration

This is a convenience function that combines application creation and execution in a single call. It’s the simplest way to run a CDC application.

§Arguments

  • config - The CDC configuration to use
  • lsn_file_path - Optional path to the LSN persistence file

§Returns

Returns CdcResult<()> when the application completes successfully or is gracefully shut down.

§Errors

Returns CdcError if application creation or execution fails.

§Example

use pg2any_lib::{app::run_cdc_app, load_config_from_env};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = load_config_from_env()?;
    run_cdc_app(config, None).await?;
    Ok(())
}