ShadowySpirits commented on code in PR #476:
URL: https://github.com/apache/rocketmq-clients/pull/476#discussion_r1168456478
##########
rust/src/conf.rs:
##########
@@ -62,31 +80,109 @@ pub enum LoggingFormat {
#[derive(Debug, Clone)]
pub struct ProducerOption {
+ producer_group: String,
logging_format: LoggingFormat,
prefetch_route: bool,
topics: Option<Vec<String>>,
namespace: String,
+ validate_message_type: bool,
}
impl Default for ProducerOption {
fn default() -> Self {
ProducerOption {
+ producer_group: "".to_string(),
logging_format: LoggingFormat::Terminal,
prefetch_route: true,
topics: None,
namespace: "".to_string(),
+ validate_message_type: true,
}
}
}
impl ProducerOption {
+ pub fn producer_group(&self) -> &str {
+ &self.producer_group
+ }
+ pub fn set_producer_group(&mut self, producer_group: impl Into<String>) {
+ self.producer_group = producer_group.into();
+ }
+
+ pub fn logging_format(&self) -> &LoggingFormat {
+ &self.logging_format
+ }
+ pub fn set_logging_format(&mut self, logging_format: LoggingFormat) {
+ self.logging_format = logging_format;
+ }
+
+ pub fn prefetch_route(&self) -> &bool {
+ &self.prefetch_route
+ }
+ pub fn set_prefetch_route(&mut self, prefetch_route: bool) {
+ self.prefetch_route = prefetch_route;
+ }
+
+ pub fn topics(&self) -> &Option<Vec<String>> {
+ &self.topics
+ }
+ pub fn set_topics(&mut self, topics: Vec<impl Into<String>>) {
+ self.topics = Some(topics.into_iter().map(|t| t.into()).collect());
+ }
+
+ pub fn namespace(&self) -> &str {
+ &self.namespace
+ }
+ pub fn set_namespace(&mut self, name_space: impl Into<String>) {
+ self.namespace = name_space.into();
+ }
+
+ pub fn validate_message_type(&self) -> bool {
+ self.validate_message_type
+ }
+ pub fn set_validate_message_type(&mut self, validate_message_type: bool) {
+ self.validate_message_type = validate_message_type;
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct SimpleConsumerOption {
+ logging_format: LoggingFormat,
+ consumer_group: String,
+ prefetch_route: bool,
+ topics: Option<Vec<String>>,
+ namespace: String,
+ await_duration: Duration,
+}
+
+impl Default for SimpleConsumerOption {
+ fn default() -> Self {
+ SimpleConsumerOption {
+ logging_format: LoggingFormat::Terminal,
+ consumer_group: "".to_string(),
+ prefetch_route: true,
+ topics: None,
+ namespace: "".to_string(),
+ await_duration: Duration::from_secs(1),
Review Comment:
Which default value do you consider more suitable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]