You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/11/23 16:50:45 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1208: MINIFICPP-1678 Create PutUDP processor (no tests or docs yet)

szaszm commented on a change in pull request #1208:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1208#discussion_r753433091



##########
File path: PROCESSORS.md
##########
@@ -1458,6 +1459,28 @@ In the list below, the names of required properties appear in bold. Any other pr
 | - | - |
 |success|After a successful SQL update operation, the incoming FlowFile sent here|
 
+## PutUDP
+
+### Description
+
+The PutUDP processor receives a FlowFile and packages the FlowFile content into a single UDP datagram packet which is then transmitted to the configured UDP server.
+The processor doesn't guarantee a successful transfer, even if the flow file is routed to the success relationship.

Review comment:
       The implementation doesn't check OS buffer sizes and other things to keep the implementation simple. We wouldn't be able to guarantee delivery anyway with UDP, so I thought this was an OK tradeoff. We can extend the processor later if needed.

##########
File path: extensions/standard-processors/tests/unit/PutUDPTests.cpp
##########
@@ -0,0 +1,171 @@
+/**
+ *
+ * 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 <memory>
+#include <new>
+#include <random>
+#include <string>
+#include <unordered_map>
+#include "range/v3/view/transform.hpp"
+#include "range/v3/range/conversion.hpp"
+#include "TestBase.h"
+#include "PutUDP.h"
+#include "utils/net/DNS.h"
+#include "utils/net/Socket.h"
+#include "utils/OptionalUtils.h"
+
+namespace org::apache::nifi::minifi::processors {
+
+namespace {
+class SingleInputTestController : public TestController {

Review comment:
       This was inspired by `RouteTextController`: it also uses a sourceless connection to push custom flow files into the processor and destinationless connections to get them out.

##########
File path: CPPLINT.cfg
##########
@@ -1,2 +1,2 @@
 set noparent
-filter=-runtime/reference,-runtime/string,-build/c++11,-build/include_subdir,-whitespace/forcolon,-build/namespaces_literals,-readability/check
+filter=-runtime/reference,-runtime/string,-build/c++11,-build/include_subdir,-whitespace/forcolon,-build/namespaces_literals,-readability/check,-whitespace/braces

Review comment:
       I got a false positive at PutUDPTests.cpp:134 when instantiating the random generator.
   
   ```
   /home/szaszm/nifi-minifi-cpp-2/extensions/standard-processors/tests/unit/PutUDPTests.cpp:133:  Missing space before {  [whitespace/braces] [5]
   ```

##########
File path: PROCESSORS.md
##########
@@ -1458,6 +1459,28 @@ In the list below, the names of required properties appear in bold. Any other pr
 | - | - |
 |success|After a successful SQL update operation, the incoming FlowFile sent here|
 
+## PutUDP
+
+### Description
+
+The PutUDP processor receives a FlowFile and packages the FlowFile content into a single UDP datagram packet which is then transmitted to the configured UDP server.
+The processor doesn't guarantee a successful transfer, even if the flow file is routed to the success relationship.
+### Properties
+
+In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
+
+|   Name   | Default Value | Allowable Values |                   Description                   |
+| -------- | ------------- | ---------------- | ----------------------------------------------- |
+| **Host** | localhost     |                  | The ip address or hostname of the destination.  |
+| **Port** |               |                  | The port on the destination.                    |

Review comment:
       No expression language support for now, although it wouldn't be too hard to add. I wanted to keep the implementation minimal until there is demand for more advanced features.
   
   not implemented nifi properties:
   - Max Size of Socket Send Buffer: I didn't bother with OS buffer sizes, defaults should work in most cases.
   - Idle Connection Expiration: Not implemented because there are no connections, so there is no point in keeping track of timeouts to then do nothing when it expires.
   - timeout: Doesn't do anything even in nifi




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org