Koji Kawamura created NIFI-1860:
-----------------------------------

             Summary: Backward compatibility for Site-to-Site client
                 Key: NIFI-1860
                 URL: https://issues.apache.org/jira/browse/NIFI-1860
             Project: Apache NiFi
          Issue Type: Sub-task
          Components: Core Framework
            Reporter: Koji Kawamura


NIFI-1554 has moved /nifi-api/controller to /nifi-api/site-to-site/ .
However, Site-to-Site client is not updated yet, and it still sends a request 
to /nifi-api/controller to obtain information for Site-to-Site. 

{code:title=EndpointConnectionPool.java}
    private ControllerDTO refreshRemoteInfo() throws IOException {
        final boolean webInterfaceSecure = 
clusterUrl.toString().startsWith("https");
        final NiFiRestApiUtil utils = new NiFiRestApiUtil(webInterfaceSecure ? 
sslContext : null);
        final ControllerDTO controller = utils.getController(apiUri + 
"/controller", commsTimeout);
{code}

We can simply change the URL to "/site-to-site", but if we do so, old version 
of NiFi won't be able to communicate with the new version of NiFi via 
Site-to-Site.
Possible approaches to provide backward compatibility are:

* A. keep the old endpoint and let it respond with 301 Moved Permanently
* B. add a ContainerRequestFilter to modify requested url
* C. Jetty Rewrite Handler 
http://www.eclipse.org/jetty/documentation/current/rewrite-handler.html

Similarly when new version of NiFi tries to communicate with old version of 
NiFi, it has to send request to /controller, instead of /site-to-site. For this 
scenario, adding retry logic in new version of SIte-to-SIte client would be 
sufficient.

# Send request to /site-to-site
# If response code is 404 or 405, then retry sending request to /controller



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to