arpadboda 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_r321224543
##########
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 +208,20 @@ public Response createPortTransaction(
final int transportProtocolVersion =
validationResult.transportProtocolVersion;
try {
- // Execute handshake.
- initiateServerProtocol(req, peer, transportProtocolVersion);
+ HttpFlowFileServerProtocol serverProtocol =
initiateServerProtocol(req, peer, transportProtocolVersion);
+
+ int protocolVersion =
Integer.parseUnsignedInt(req.getHeader(PROTOCOL_VERSION));
+ if ((protocolVersion >= 2) && 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");
+ return
noCache(Response.status(Response.Status.NO_CONTENT)).type(MediaType.TEXT_PLAIN).entity("No
flowfiles available").build();
Review comment:
Good spot, thank you, fixed!
----------------------------------------------------------------
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