[
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380528#comment-16380528
]
ASF GitHub Bot commented on MINIFICPP-397:
------------------------------------------
Github user minifirocks commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/268#discussion_r171293683
--- Diff: libminifi/src/processors/RouteOnAttribute.cpp ---
@@ -0,0 +1,107 @@
+/**
+ * @file RouteOnAttribute.cpp
+ * RouteOnAttribute class implementation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "processors/RouteOnAttribute.h"
+
+#include <memory>
+#include <string>
+#include <set>
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+core::Relationship RouteOnAttribute::Unmatched(
+ "unmatched",
+ "Files which do not match any expression are routed here");
+core::Relationship RouteOnAttribute::Failure(
+ "failure",
+ "Failed files are transferred to failure");
+
+void RouteOnAttribute::initialize() {
+ std::set<core::Property> properties;
+ setSupportedProperties(properties);
+}
+
+void RouteOnAttribute::onDynamicPropertyModified(const core::Property
&orig_property,
+ const core::Property
&new_property) {
+
+ // Update the routing table when routes are added via dynamic properties.
+ route_properties_[new_property.getName()] = new_property;
+
+ std::set<core::Relationship> relationships;
+
+ for (const auto &route : route_properties_) {
+ core::Relationship route_rel{route.first, "Dynamic route"};
+ route_rels_[route.first] = route_rel;
+ relationships.insert(route_rel);
+ logger_->log_info("RouteOnAttribute registered route '%s' with
expression '%s'",
+ route.first,
+ route.second.getValue());
+ }
+
+ relationships.insert(Unmatched);
+ relationships.insert(Failure);
+ setSupportedRelationships(relationships);
--- End diff --
bool Connectable::setSupportedRelationships(std::set<core::Relationship>
relationships) {
if (isRunning()) {
logger_->log_warn("Can not set processor supported relationship while
the process %s is running", name_);
return false;
}
what if we do the onDynamicPropertyModified while the processor is running
> Implement RouteOnAttribute
> --------------------------
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
> Issue Type: Improvement
> Reporter: Andrew Christianson
> Assignee: Andrew Christianson
> Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be
> implemented.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)