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/05 09:54:06 UTC

[GitHub] [rocketmq-clients] leizhiyuan opened a new pull request, #350: add a basic producer demo

leizhiyuan opened a new pull request, #350:
URL: https://github.com/apache/rocketmq-clients/pull/350

   add a basic implement for producer with rust


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


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

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
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


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

Posted by "lizhanhui (via GitHub)" <gi...@apache.org>.
lizhanhui commented on code in PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#discussion_r1118601159


##########
rust/src/client.rs:
##########
@@ -89,6 +111,119 @@ impl Session {
 struct SessionManager {
     logger: Logger,
     tx: tokio::sync::mpsc::Sender<command::Command>,
+    selector: QueueSelector,

Review Comment:
   `QueueSelector` makes sense to Producer only. Best to move to the Producer struct.



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


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

Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#issuecomment-1417277712

   now ,rust can not support tls ,there are some problems I do not resolve.


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


[GitHub] [rocketmq-clients] github-actions[bot] commented on pull request #350: add a basic producer demo

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#issuecomment-1556343118

   This PR was closed because it has been inactive for 3 days since being marked as stale.


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


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

Posted by "aaron-ai (via GitHub)" <gi...@apache.org>.
aaron-ai commented on code in PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#discussion_r1113059403


##########
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).



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


[GitHub] [rocketmq-clients] github-actions[bot] commented on pull request #350: add a basic producer demo

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#issuecomment-1553838413

   This PR is stale because it has been open for 30 days with no activity. It will be closed in 3 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR.


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


[GitHub] [rocketmq-clients] github-actions[bot] closed pull request #350: add a basic producer demo

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #350: add a basic producer demo
URL: https://github.com/apache/rocketmq-clients/pull/350


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


[GitHub] [rocketmq-clients] aaron-ai commented on pull request #350: add a basic producer demo

Posted by "aaron-ai (via GitHub)" <gi...@apache.org>.
aaron-ai commented on PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#issuecomment-1438496056

   I'm sorry, I just started reviewing this PR because I'm not very familiar with Rust. It would be even better if other peers who are familiar with Rust could participate as well.


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


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

Posted by "lizhanhui (via GitHub)" <gi...@apache.org>.
lizhanhui commented on code in PR #350:
URL: https://github.com/apache/rocketmq-clients/pull/350#discussion_r1118607137


##########
rust/src/client.rs:
##########
@@ -89,6 +111,119 @@ impl Session {
 struct SessionManager {
     logger: Logger,
     tx: tokio::sync::mpsc::Sender<command::Command>,
+    selector: QueueSelector,
+}
+
+impl SessionManager {
+    async fn send(
+        &self,
+        message: &models::message::MessageImpl,
+        client: Weak<&Client>,
+    ) -> Result<SendMessageResponse, ClientError> {

Review Comment:
   SessionManager helps manage sessions: by maintaining heartbeat, and administrative controlling flow...
   
   Specific send steps should go to `Session` and `SessionManager` should directly forward workload to a target session after looking up the route-table: mapping between topic/queue to host addresses.
   



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