lizhanhui commented on code in PR #476:
URL: https://github.com/apache/rocketmq-clients/pull/476#discussion_r1168207599


##########
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: String) {
+        self.producer_group = producer_group;
+    }
+
+    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<String>) {
+        self.topics = Some(topics);
+    }
+
+    pub fn namespace(&self) -> &str {
+        &self.namespace
+    }
+    pub fn set_namespace(&mut self, name_space: String) {
+        self.namespace = name_space;
+    }
+
+    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),
+        }
+    }
+}
+
+impl SimpleConsumerOption {
     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 consumer_group(&self) -> &str {
+        &self.consumer_group
+    }
+    pub fn set_consumer_group(&mut self, consumer_group: String) {

Review Comment:
   Should accept AsRef<str>. That is, the signature should be 
   
   ```
   pub fn set_consumer_group(&mut self, consumer_group: AsRef<str>)
   ```
   
   This way, application developers can write 
   
   ```
   let mut options = SimpleConsumerOption::default();
   options.set_consumer_group("Group1");
   ```



-- 
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]

Reply via email to