From 69b55058ce988416dc816328281f57f2d3548566 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 14 May 2026 12:37:16 +0200 Subject: [PATCH] =?UTF-8?q?feat(worker):=20use=20EventConsumerAdapter=20=E2=80=94=20transport-agnostic=20consuming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/worker/Cargo.toml | 7 ++++--- crates/worker/src/main.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/worker/Cargo.toml b/crates/worker/Cargo.toml index bb5c47c..c63425c 100644 --- a/crates/worker/Cargo.toml +++ b/crates/worker/Cargo.toml @@ -8,9 +8,10 @@ name = "thoughts-worker" path = "src/main.rs" [dependencies] -domain = { workspace = true } -nats = { workspace = true } -event-payload = { workspace = true } +domain = { workspace = true } +nats = { workspace = true } +event-payload = { workspace = true } +event-transport = { workspace = true } postgres = { workspace = true } async-nats = { workspace = true } tokio = { workspace = true, features = ["full"] } diff --git a/crates/worker/src/main.rs b/crates/worker/src/main.rs index c7405fa..f2827ab 100644 --- a/crates/worker/src/main.rs +++ b/crates/worker/src/main.rs @@ -20,7 +20,7 @@ async fn main() { tracing::info!("Connecting to NATS at {nats_url}..."); let nats_client = async_nats::connect(&nats_url).await.expect("NATS connect failed"); - let consumer = nats::NatsEventConsumer::new(nats_client); + let consumer = event_transport::EventConsumerAdapter::new(nats::NatsMessageSource::new(nats_client)); let notification_handler = handlers::NotificationHandler { thoughts: Arc::new(postgres::thought::PgThoughtRepository::new(pool.clone())),