diff --git a/omni-relayer/src/config.rs b/omni-relayer/src/config.rs index e26efa07..cd635196 100644 --- a/omni-relayer/src/config.rs +++ b/omni-relayer/src/config.rs @@ -211,23 +211,31 @@ pub struct Redis { pub struct Nats { pub url: String, pub relayer_subject: String, - pub omni_consumer: NatsConsumer, - pub relayer_consumer: NatsConsumer, + pub omni_consumer: OmniConsumer, + pub relayer_consumer: RelayerConsumer, } #[derive(Debug, Clone, Deserialize)] -pub struct NatsConsumer { +pub struct OmniConsumer { pub name: String, pub stream: String, pub subject: String, pub max_deliver: i64, #[serde(default)] pub backoff_secs: Vec, - #[serde(default = "default_worker_count")] - pub worker_count: usize, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct RelayerConsumer { + pub name: String, + pub stream: String, + pub subject: String, + pub max_deliver: i64, pub ack_wait: u64, pub max_backoff_hours: u64, pub max_message_age_hours: u64, + #[serde(default = "default_worker_count")] + pub worker_count: usize, } fn default_worker_count() -> usize { diff --git a/omni-relayer/src/utils/nats.rs b/omni-relayer/src/utils/nats.rs index 84228bc8..12f9333d 100644 --- a/omni-relayer/src/utils/nats.rs +++ b/omni-relayer/src/utils/nats.rs @@ -35,8 +35,7 @@ impl NatsClient { deliver_policy: consumer::DeliverPolicy::Last, max_deliver: config.omni_consumer.max_deliver, filter_subject: config.omni_consumer.subject.clone(), - backoff: config - .omni_consumer + backoff: config.omni_consumer .backoff_secs .iter() .map(|&s| Duration::from_secs(s)) diff --git a/omni-relayer/src/workers/mod.rs b/omni-relayer/src/workers/mod.rs index 04dde586..a3fc51ac 100644 --- a/omni-relayer/src/workers/mod.rs +++ b/omni-relayer/src/workers/mod.rs @@ -171,7 +171,7 @@ pub enum DeployToken { async fn handle_nats_ack( msg: &async_nats::jetstream::message::Message, result: &Result, - config: &config::NatsConsumer, + config: &config::RelayerConsumer, ) { let max_backoff = Duration::from_secs(config.max_backoff_hours * 3600); let max_message_age = Duration::from_secs(config.max_message_age_hours * 3600);