@@ -10,6 +10,7 @@ use forage_core::integrations::IntegrationStore;
|
||||
use notmad::{Component, ComponentInfo, MadError};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::forest_client::GrpcForestClient;
|
||||
use crate::notification_worker::NotificationDispatcher;
|
||||
|
||||
/// Background component that pulls notification events from NATS JetStream
|
||||
@@ -17,6 +18,9 @@ use crate::notification_worker::NotificationDispatcher;
|
||||
pub struct NotificationConsumer {
|
||||
pub jetstream: jetstream::Context,
|
||||
pub store: Arc<dyn IntegrationStore>,
|
||||
pub forage_url: String,
|
||||
pub grpc: Arc<GrpcForestClient>,
|
||||
pub service_token: String,
|
||||
}
|
||||
|
||||
impl Component for NotificationConsumer {
|
||||
@@ -25,7 +29,10 @@ impl Component for NotificationConsumer {
|
||||
}
|
||||
|
||||
async fn run(&self, cancellation_token: CancellationToken) -> Result<(), MadError> {
|
||||
let dispatcher = Arc::new(NotificationDispatcher::new(self.store.clone()));
|
||||
let dispatcher = Arc::new(
|
||||
NotificationDispatcher::new(self.store.clone(), self.forage_url.clone())
|
||||
.with_grpc(self.grpc.clone(), self.service_token.clone()),
|
||||
);
|
||||
|
||||
let mut backoff = 1u64;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user