diff --git a/crates/bootstrap/Cargo.toml b/crates/bootstrap/Cargo.toml index 446a33e..5f7f817 100644 --- a/crates/bootstrap/Cargo.toml +++ b/crates/bootstrap/Cargo.toml @@ -16,6 +16,7 @@ postgres-federation = { workspace = true } activitypub = { workspace = true } activitypub-base = { workspace = true } nats = { workspace = true } +event-publisher = { workspace = true } auth = { workspace = true } sqlx = { workspace = true } async-nats = { workspace = true } diff --git a/crates/bootstrap/src/factory.rs b/crates/bootstrap/src/factory.rs index 5cfbad6..1d81535 100644 --- a/crates/bootstrap/src/factory.rs +++ b/crates/bootstrap/src/factory.rs @@ -5,6 +5,8 @@ use sqlx::PgPool; use activitypub::ThoughtsObjectHandler; use activitypub_base::{ApFederationConfig, FederationData}; use domain::{errors::DomainError, events::DomainEvent, ports::EventPublisher}; +use event_publisher::EventPublisherAdapter; +use nats::NatsTransport; use postgres::activitypub::PgActivityPubRepository; use postgres_federation::{PostgresApUserRepository, PostgresFederationRepository}; use presentation::state::AppState; @@ -40,7 +42,7 @@ pub async fn build(cfg: &Config) -> Infrastructure { Some(url) => match async_nats::connect(url).await { Ok(client) => { tracing::info!("Connected to NATS at {url}"); - Arc::new(nats::NatsEventPublisher::new(client)) + Arc::new(EventPublisherAdapter::new(NatsTransport::new(client))) } Err(e) => { tracing::warn!("NATS connect failed ({e}) — falling back to no-op publisher");