zk-drizzle commented on code in PR #1211:
URL: https://github.com/apache/rocketmq-clients/pull/1211#discussion_r3007734085


##########
nodejs/src/producer/Producer.ts:
##########
@@ -333,4 +336,53 @@ export class Producer extends BaseClient {
   #getRetryPolicy() {
     return this.#publishingSettings.getRetryPolicy()!;
   }
+
+  /**
+   * Recalls a scheduled/delayed message based on the topic and recall handle.
+   * This operation requires server support and can only be performed before 
the message is delivered.
+   *
+   * @param topic - The topic associated with the scheduled message to be 
canceled.
+   * @param recallHandle - A unique handle to identify the message to recall 
(obtained from SendReceipt).
+   * @returns Promise resolving to RecallReceipt containing the recalled 
message ID.
+   * @throws Error if producer is not running or recall handle is invalid.
+   */
+  async recallMessage(topic: string, recallHandle: string): 
Promise<RecallReceipt> {
+    if (!this.isRunning()) {
+      this.logger.error('Unable to recall message because producer is not 
running, clientId=%s', this.clientId);
+      throw new Error('Producer is not running now');
+    }
+

Review Comment:
   Missing validation for the topic` parameter.`
   // Validate topic
     if (!topic || typeof topic !== 'string' || topic.trim().length === 0) {
       this.logger.error('Topic is invalid for recall message, clientId=%s', 
this.clientId);
       throw new Error('Topic is invalid');
     }



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