#[derive(Clone, Debug)]
pub struct SubscriberConfig {
pub(in super::super) consumer_name: String,
pub(in super::super) group_name: String,
pub(in super::super) topic_name: String,
pub(in super::super) num_fetch: usize,
pub(in super::super) block_time: usize,
pub(in super::super) auto_claim: usize,
}
impl SubscriberConfig {
pub fn new(topic_name: impl Into<String>) -> Self {
let topic_name = topic_name.into();
Self {
consumer_name: topic_name.clone(),
group_name: topic_name.clone(),
topic_name: topic_name,
num_fetch: 10, block_time: 5000, auto_claim: 30000, }
}
pub fn consumer_name(mut self, consumer_name: impl Into<String>) -> Self {
self.consumer_name = consumer_name.into();
self
}
pub fn group_name(mut self, group_name: impl Into<String>) -> Self {
self.group_name = group_name.into();
self
}
pub fn topic_name(mut self, topic_name: impl Into<String>) -> Self {
self.topic_name = topic_name.into();
self
}
pub fn num_fetch(mut self, count: usize) -> Self {
self.num_fetch = count;
self
}
pub fn block_time(mut self, millis: usize) -> Self {
self.block_time = millis;
self
}
pub fn auto_claim(mut self, millis: usize) -> Self {
self.auto_claim = millis;
self
}
}