phrocker commented on a change in pull request #3647: NIFI-6530 - HTTP 
SiteToSite server returns 201 in case no data is ava…
URL: https://github.com/apache/nifi/pull/3647#discussion_r313094363
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java
 ##########
 @@ -205,9 +207,17 @@ public Response createPortTransaction(
         final int transportProtocolVersion = 
validationResult.transportProtocolVersion;
 
         try {
-            // Execute handshake.
-            initiateServerProtocol(req, peer, transportProtocolVersion);
+            HttpFlowFileServerProtocol serverProtocol = 
initiateServerProtocol(req, peer, transportProtocolVersion);
+            if (PORT_TYPE_OUTPUT.equals(portType)) {
+                List<Connection> connectionList = 
serverProtocol.getPort().getIncomingConnections();
+                if (connectionList.stream().allMatch(c -> 
c.getFlowFileQueue().isEmpty())) {
+                    // Transaction could be created, but there is nothing to 
transfer. Just return 200.
+                    logger.debug("Output port has no flowfiles to transfer, 
returning 200");
 
 Review comment:
   @ijokarumawak or @mcgilman  Can probably highlight whether the approach 
outlined here is okay. Looking at the code I see why you may have followed the 
200, but the case here implies 204 imo. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to