ijokarumawak 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_r314227662
 
 

 ##########
 File path: 
nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
 ##########
 @@ -168,6 +169,9 @@ public Transaction createTransaction(final 
TransferDirection direction) throws H
             try {
                 transactionUrl = apiClient.initiateTransaction(direction, 
portId);
                 commSession.setUserDn(apiClient.getTrustedPeerDn());
+            } catch (final NoContentException e) {
+                logger.debug("Peer {} has no flowfiles to provide", peer);
+                throw e;
 
 Review comment:
   If the remote NiFi is a cluster and there are multiple NiFi nodes, even if 
this client get NoContentException from node1, node2 may have queued data to 
transfer. I think we should keep iterating next peer in this case, instead of 
throwing the exception.
   
   If no node has data, this method eventually returns `null` transaction. From 
callers, it looks the same with the case where all nodes are penalized. I think 
that is acceptable.
   If we take this approach, we don't have to catch `NoContentException` at 
callers such as StandardRemoteGroupPort.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to