feat: event ids, outbox identity migration
This commit is contained in:
@@ -26,23 +26,14 @@ impl EventBusBackend {
|
||||
}
|
||||
}
|
||||
|
||||
/// The server's publisher is always the outbox writer: it never talks to the
|
||||
/// bus, whatever `EVENT_BUS_BACKEND` says. The worker owns delivery.
|
||||
pub async fn create_publisher(
|
||||
db_pool: &sqlx::SqlitePool,
|
||||
config: &config::AppConfig,
|
||||
) -> anyhow::Result<Arc<dyn EventPublisher>> {
|
||||
match EventBusBackend::from_config(&config.events)? {
|
||||
EventBusBackend::Db => {
|
||||
tracing::info!("event bus: DB queue");
|
||||
Ok(sqlite::SqliteEventQueue::create_publisher(db_pool.clone(), &config.events).await?)
|
||||
}
|
||||
#[cfg(feature = "nats")]
|
||||
EventBusBackend::Nats => {
|
||||
let cfg = nats::NatsConfig::from_config(&config.nats)
|
||||
.context("EVENT_BUS_BACKEND=nats requires NATS_URL to be set")?;
|
||||
tracing::info!("event bus: NATS ({})", cfg.url);
|
||||
Ok(nats::create_publisher(cfg).await?)
|
||||
}
|
||||
}
|
||||
tracing::info!("event publisher: outbox (DB queue)");
|
||||
sqlite::SqliteEventQueue::create_publisher(db_pool.clone(), &config.events).await
|
||||
}
|
||||
|
||||
pub async fn create_channel(
|
||||
|
||||
Reference in New Issue
Block a user