support disable replication (#149)
Co-authored-by: yfuruta <yfuruta@yahoo-corp.jp>
diff --git a/src/Message.cc b/src/Message.cc
index d93264e..fc0e82c 100644
--- a/src/Message.cc
+++ b/src/Message.cc
@@ -29,6 +29,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";
Napi::FunctionReference Message::constructor;
@@ -206,6 +207,13 @@
Napi::Number deliverAt = conf.Get(CFG_DELIVER_AT).ToNumber();
pulsar_message_set_deliver_at(cMessage, deliverAt.Int64Value());
}
+
+ if (conf.Has(CFG_DISABLE_REPLICATION) && conf.Get(CFG_DISABLE_REPLICATION).IsBoolean()) {
+ Napi::Boolean disableReplication = conf.Get(CFG_DISABLE_REPLICATION).ToBoolean();
+ if (disableReplication.Value()) {
+ pulsar_message_disable_replication(cMessage, 1);
+ }
+ }
return cMessage;
}