You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "leizhiyuan (via GitHub)" <gi...@apache.org> on 2023/02/24 23:53:34 UTC

[GitHub] [rocketmq-clients] leizhiyuan commented on a diff in pull request #350: add a basic producer demo

leizhiyuan commented on code in PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#discussion_r1117813855


##########
rust/src/client.rs:
##########
@@ -91,6 +111,117 @@ struct SessionManager {
     tx: tokio::sync::mpsc::Sender<command::Command>,
 }
 
+impl SessionManager {
+    async fn send(
+        &self,
+        message: &models::MessageImpl,
+        client: Weak<&Client>,
+    ) -> Result<SendMessageResponse, ClientError> {
+        let client = match client.upgrade() {
+            Some(client) => client,
+            None => {
+                return Err(error::ClientError::ClientInternal);
+            }
+        };
+
+        let mut srequest = SendMessageRequest {
+            messages: vec![],
+        };
+
+
+        let mut delivery_timestamp = None;
+
+        if message.deliveryTimestamp != 0 {
+            delivery_timestamp = Option::from(Timestamp {
+                seconds: message.deliveryTimestamp,
+                nanos: 0,
+            })
+        }
+
+        srequest.messages.push(pb::Message {
+            topic: Some(Resource {
+                resource_namespace: "".to_string(),
+                name: message.topic.clone(),
+            }),
+            user_properties: Default::default(),
+            system_properties: Option::from(pb::SystemProperties {
+                tag: Option::from(message.tags.clone()),
+                keys: message.keys.clone(),
+                message_id: "123".to_string(),

Review Comment:
   > It would be great if the message id could be generated according to the rules [here](https://github.com/apache/rocketmq-clients/blob/master/docs/message_id.md).
   
   doneļ¼Œsomeone can run the test case to verify it



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org