nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ald...@apache.org
Subject [nifi-minifi-cpp] branch master updated: MINIFICPP-758: Make CoAP default protocol and add properties as identifiers
Date Fri, 08 Mar 2019 15:53:04 GMT
This is an automated email from the ASF dual-hosted git repository.

aldrin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 83bd11b  MINIFICPP-758: Make CoAP default protocol and add properties as identifiers
83bd11b is described below

commit 83bd11be9687715b79210d8554a5d057b10a20c9
Author: Marc Parisi <phrocker@apache.org>
AuthorDate: Fri Mar 8 10:26:45 2019 -0500

    MINIFICPP-758: Make CoAP default protocol and add properties as identifiers
    
    This closes #503.
    
    Signed-off-by: Aldrin Piri <aldrin@apache.org>
---
 C2.md                        |  9 +++++----
 conf/minifi.properties       | 28 +++++++++++++++++++++++++++-
 libminifi/src/c2/C2Agent.cpp |  6 +++---
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/C2.md b/C2.md
index aa7e322..1ba1eba 100644
--- a/C2.md
+++ b/C2.md
@@ -58,13 +58,14 @@ an alternate key, but you are encouraged to switch your configuration
options as
 	# specify classes for the AST response
 	nifi.c2.root.classes=DeviceInfoNode,AgentInformation,FlowInformation
 	
-	# specify C2 protocol -- default is RESTSender if this is not specified
-	nifi.c2.agent.protocol.class=RESTSender
-	# may also use MQTT
+	# specify C2 protocol -- default is CoapProtocol if not specified
+	nifi.c2.agent.protocol.class=CoapProtocol
+	# may also use MQTT or REST
 	# nifi.c2.agent.protocol.class=MQTTC2Protocol
+	# nifi.c2.agent.protocol.class=RESTSender
 	
 	# control c2 heartbeat interval in millisecocnds
-	nifi.c2.agent.heartbeat.period=3000
+	nifi.c2.agent.heartbeat.period=250
 	
 	# enable reporter classes
 	nifi.c2.agent.heartbeat.reporter.class=RESTReciver
diff --git a/conf/minifi.properties b/conf/minifi.properties
index 6d8b681..dcf773f 100644
--- a/conf/minifi.properties
+++ b/conf/minifi.properties
@@ -37,6 +37,32 @@ nifi.database.content.repository.directory.default=${MINIFI_HOME}/content_reposi
 #nifi.rest.api.user.name=admin
 #nifi.rest.api.password=password
 
+## Enabling C2 Uncomment each of the following options
+## define those with missing options
+#nifi.c2.enable=true
+## define protocol parameters
+#nifi.c2.agent.protocol.class=CoapProtocol
+#nifi.c2.agent.coap.host=
+#nifi.c2.agent.coap.port=
+#nifi.c2.rest.url=
+#nifi.c2.rest.url.ack=
+#nifi.c2.root.classes=DeviceInfoNode,AgentInformation,FlowInformation
+## heartbeat 4 times a second
+#nifi.c2.agent.heartbeat.period=250
+## define parameters about your agent 
+#nifi.c2.agent.class=
+#nifi.c2.agent.identifier=
+## define metrics reported
+#nifi.c2.root.class.definitions=metrics
+#nifi.c2.root.class.definitions.metrics.name=metrics
+#nifi.c2.root.class.definitions.metrics.metrics=typedmetrics
+#nifi.c2.root.class.definitions.metrics.metrics.typedmetrics.name=RuntimeMetrics
+#nifi.c2.root.class.definitions.metrics.metrics.queuemetrics.name=QueueMetrics
+#nifi.c2.root.class.definitions.metrics.metrics.queuemetrics.classes=QueueMetrics
+#nifi.c2.root.class.definitions.metrics.metrics.typedmetrics.classes=ProcessMetrics,SystemInformation
+#nifi.c2.root.class.definitions.metrics.metrics.processorMetrics.name=ProcessorMetric
+#nifi.c2.root.class.definitions.metrics.metrics.processorMetrics.classes=GetFileMetrics
+
 ## enable the controller socket provider on port 9998
 ## off by default. C2 must be enabled to support these
 #controller.socket.host=localhost
@@ -50,4 +76,4 @@ nifi.nar.deploy.directory=${MINIFI_HOME}/minifi-jni/nardeploy
 nifi.nar.docs.directory=${MINIFI_HOME}/minifi-jni/nardocs
 # must be comma separated 
 nifi.jvm.options=-Xmx1G
-nifi.python.processor.dir=${MINIFI_HOME}/minifi-python/
\ No newline at end of file
+nifi.python.processor.dir=${MINIFI_HOME}/minifi-python/
diff --git a/libminifi/src/c2/C2Agent.cpp b/libminifi/src/c2/C2Agent.cpp
index d6fe1b1..b64e65e 100644
--- a/libminifi/src/c2/C2Agent.cpp
+++ b/libminifi/src/c2/C2Agent.cpp
@@ -151,19 +151,19 @@ void C2Agent::configure(const std::shared_ptr<Configure> &configure,
bool reconf
 
   if (!reconfigure) {
     if (!configure->get("nifi.c2.agent.protocol.class", "c2.agent.protocol.class", clazz))
{
-      clazz = "RESTSender";
+      clazz = "CoapProtocol";
     }
     logger_->log_info("Class is %s", clazz);
     auto protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw(clazz, clazz);
 
     if (protocol == nullptr) {
       logger_->log_info("Class %s not found", clazz);
-      protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw("RESTSender",
"RESTSender");
+      protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw("CoapProtocol",
"RESTSender");
 
       if (!protocol) {
         return;
       }
-      logger_->log_info("Class is RESTSender");
+      logger_->log_info("Class is CoapProtocol");
     }
     C2Protocol *old_protocol = protocol_.exchange(dynamic_cast<C2Protocol*>(protocol));
 


Mime
View raw message