You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by k2...@apache.org on 2021/05/21 00:55:18 UTC

[pulsar-client-node] branch master updated: added functionality for orderingkey (#155)

This is an automated email from the ASF dual-hosted git repository.

k2la pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
     new 6705a25  added functionality for orderingkey (#155)
6705a25 is described below

commit 6705a258da6a2135b6ac70a9324efaf9bad4af86
Author: Rami <29...@users.noreply.github.com>
AuthorDate: Thu May 20 19:55:12 2021 -0500

    added functionality for orderingkey (#155)
---
 src/Message.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Message.cc b/src/Message.cc
index fc0e82c..a44d225 100644
--- a/src/Message.cc
+++ b/src/Message.cc
@@ -30,6 +30,7 @@ static const std::string CFG_REPL_CLUSTERS = "replicationClusters";
 static const std::string CFG_DELIVER_AFTER = "deliverAfter";
 static const std::string CFG_DELIVER_AT = "deliverAt";
 static const std::string CFG_DISABLE_REPLICATION = "disableReplication";
+static const std::string CFG_ORDERING_KEY = "orderingKey";
 
 Napi::FunctionReference Message::constructor;
 
@@ -214,6 +215,12 @@ pulsar_message_t *Message::BuildMessage(Napi::Object conf) {
       pulsar_message_disable_replication(cMessage, 1);
     }
   }
+
+  if (conf.Has(CFG_ORDERING_KEY) && conf.Get(CFG_ORDERING_KEY).IsString()) {
+    Napi::String orderingKey = conf.Get(CFG_ORDERING_KEY).ToString();
+    pulsar_message_set_ordering_key(cMessage, orderingKey.Utf8Value().c_str());
+  }
+
   return cMessage;
 }