Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(db): Add TenantId field to the KafkaStore struct (#4512)

Subhajit Ghoshdca15aeeb501
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index c34bcaa1e3..6ba5b601a3 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -19,7 +19,7 @@ pub mod file;
pub mod fraud_check;
pub mod gsm;
pub mod health_check;
-mod kafka_store;
+pub mod kafka_store;
pub mod locker_mock_up;
pub mod mandate;
pub mod merchant_account;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 4a9ab7fc8f..a64e3cc7e3 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -25,6 +25,7 @@ use scheduler::{
db::{process_tracker::ProcessTrackerInterface, queue::QueueInterface},
SchedulerInterface,
};
+use serde::Serialize;
use storage_impl::redis::kv_store::RedisConnInterface;
use time::PrimitiveDateTime;
@@ -75,17 +76,22 @@ use crate::{
},
};
+#[derive(Clone, Serialize)]
+pub struct TenantID(pub String);
+
#[derive(Clone)]
pub struct KafkaStore {
kafka_producer: KafkaProducer,
pub diesel_store: Store,
+ pub tenant_id: TenantID,
}
impl KafkaStore {
- pub async fn new(store: Store, kafka_producer: KafkaProducer) -> Self {
+ pub async fn new(store: Store, kafka_producer: KafkaProducer, tenant_id: TenantID) -> Self {
Self {
kafka_producer,
diesel_store: store,
+ tenant_id,
}
}
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index cff4fc67db..1560578f66 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -198,6 +198,7 @@ impl AppState {
.await
.expect("Failed to create store"),
kafka_client.clone(),
+ crate::db::kafka_store::TenantID("default".to_string()),
)
.await,
),