feat(worker): use EventConsumerAdapter<NatsMessageSource> — transport-agnostic consuming
This commit is contained in:
@@ -8,9 +8,10 @@ name = "thoughts-worker"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
domain = { workspace = true }
|
domain = { workspace = true }
|
||||||
nats = { workspace = true }
|
nats = { workspace = true }
|
||||||
event-payload = { workspace = true }
|
event-payload = { workspace = true }
|
||||||
|
event-transport = { workspace = true }
|
||||||
postgres = { workspace = true }
|
postgres = { workspace = true }
|
||||||
async-nats = { workspace = true }
|
async-nats = { workspace = true }
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ async fn main() {
|
|||||||
|
|
||||||
tracing::info!("Connecting to NATS at {nats_url}...");
|
tracing::info!("Connecting to NATS at {nats_url}...");
|
||||||
let nats_client = async_nats::connect(&nats_url).await.expect("NATS connect failed");
|
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 {
|
let notification_handler = handlers::NotificationHandler {
|
||||||
thoughts: Arc::new(postgres::thought::PgThoughtRepository::new(pool.clone())),
|
thoughts: Arc::new(postgres::thought::PgThoughtRepository::new(pool.clone())),
|
||||||
|
|||||||
Reference in New Issue
Block a user