kevdoran commented on PR #10476:
URL: https://github.com/apache/nifi/pull/10476#issuecomment-3470242287

   I simplified this branch to have the bare minimum for the following:
   
   - Include Listen Port definitions in extension manifests, flow definitions, 
versioned flows, etc.
   - REST API is able to report Listen Ports the framework can discover that 
the user is authorized for
   - Framework is able to discover Listen Ports from components that implement 
new ListenComponent interface
   - ListenHTTP is updated to support new interfaces for testing all of the 
above
   
   I restructured the 
[commits](https://github.com/apache/nifi/pull/10476/commits) so that they are 
individually reviewable for each of the areas above.
   
   To test the functionality:
   
   1. Build this branch (skip contrib-check, I still have some cleanup to do_
   2. Observe that the manifest file for ListenHTTP 
`nifi-extension-bundles/nifi-standard-bundle/nifi-standard-nar/target/META-INF/docs/extension-manifest.xml`
 includes the ListenPort definition in PropertyDescriptors:
   
   ```xml
   # 
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-nar/target/META-INF/docs/extension-manifest.xml
   <property>
        <name>Listening Port</name>
        <displayName>Listening Port</displayName>
        <description>The Port to listen on for incoming 
connections</description>
        <required>true</required>
        <sensitive>false</sensitive>
        <expressionLanguageSupported>true</expressionLanguageSupported>
        <expressionLanguageScope>ENVIRONMENT</expressionLanguageScope>
        <dynamicallyModifiesClasspath>false</dynamicallyModifiesClasspath>
        <dynamic>false</dynamic>
        <listenPortDefinition>
                <transportProtocol>TCP</transportProtocol>
                <applicationProtocols>
                        <applicationProtocol>http/1.1</applicationProtocol>
                        <applicationProtocol>h2</applicationProtocol>
                </applicationProtocols>
        </listenPortDefinition>
   </property>
   <property>
        <name>health-check-port</name>
        <displayName>Listening Port for Health Check Requests</displayName>
        <required>false</required>
        <sensitive>false</sensitive>
        <expressionLanguageSupported>true</expressionLanguageSupported>
        <expressionLanguageScope>ENVIRONMENT</expressionLanguageScope>
        <dynamicallyModifiesClasspath>false</dynamicallyModifiesClasspath>
        <dynamic>false</dynamic>
        <listenPortDefinition>
                <transportProtocol>TCP</transportProtocol>
                <applicationProtocols>
                        <applicationProtocol>http/1.1</applicationProtocol>
                        <applicationProtocol>h2</applicationProtocol>
                </applicationProtocols>
        </listenPortDefinition>
   </property>
   ```
   
   3. Start NiFi and go to NiFi UI in browser: https://localhost:8443/nifi 
   
   ```
   NIFI_DIR=nifi-assembly/target/nifi-2.7.0-SNAPSHOT-bin/nifi-2.7.0-SNAPSHOT && 
./$NIFI_DIR/bin/nifi.sh set-single-user-credentials admin ***** && 
$NIFI_DIR/bin/nifi.sh start && tail -f $NIFI_DIR/logs/nifi-*.log
   ```
   
   4. Add one or more ListenHTTP Processors to the canvas. Try nesting them in 
Process Groups. Configure each to have Port property and optionally and Health 
Check port as well.
   
   5. In the same browser (for auth cookie reasons) go to this new NiFi REST 
API url: https://localhost:8443/nifi-api/flow/listen-ports - you should see 
something like the following:
   
   ```json
   {
     "listenPorts": [
       {
         "portNumber": 12345,
         "transportProtocol": "TCP",
         "applicationProtocols": [
           "http/1.1"
         ],
         "componentType": "Processor",
         "componentId": "36cc4d72-019a-1000-bb5c-ca9e515d29f0",
         "componentName": "ListenHTTP",
         "componentClass": "org.apache.nifi.processors.standard.ListenHTTP",
         "parentGroupId": "36cbfb7f-019a-1000-3fa2-66e24d7ab4af",
         "parentGroupName": "NiFi Flow"
       },
       {
         "portNumber": 23456,
         "transportProtocol": "TCP",
         "applicationProtocols": [
           "http/1.1"
         ],
         "componentType": "Processor",
         "componentId": "36cc4d72-019a-1000-bb5c-ca9e515d29f0",
         "componentName": "ListenHTTP",
         "componentClass": "org.apache.nifi.processors.standard.ListenHTTP",
         "parentGroupId": "36cbfb7f-019a-1000-3fa2-66e24d7ab4af",
         "parentGroupName": "NiFi Flow"
       },
       {
         "portNumber": 8888,
         "transportProtocol": "TCP",
         "applicationProtocols": [
           "http/1.1"
         ],
         "componentType": "Processor",
         "componentId": "36ccbc61-019a-1000-eec1-67567effc4da",
         "componentName": "Listen For Jira Webhook Events",
         "componentClass": "org.apache.nifi.processors.standard.ListenHTTP",
         "parentGroupId": "36cca021-019a-1000-3143-8c31afe40b9e",
         "parentGroupName": "My Custom PG"
       }
     ]
   }
   ```
   
   6. Download the flow definition JSON. Observe that the processor property 
descriptors contain the listen port definitions:
   
   ```json
   "health-check-port": {
       "name": "health-check-port",
       "displayName": "Listening Port for Health Check Requests",
       "identifiesControllerService": false,
       "sensitive": false,
       "dynamic": false,
       "listenPortDefinition":
       {
           "transportProtocol": "TCP",
           "applicationProtocols":
           [
               "http/1.1",
               "h2"
           ]
       }
   },
   "Listening Port": {
       "name": "Listening Port",
       "displayName": "Listening Port",
       "identifiesControllerService": false,
       "sensitive": false,
       "dynamic": false,
       "listenPortDefinition":
       {
           "transportProtocol": "TCP",
           "applicationProtocols":
           [
               "http/1.1",
               "h2"
           ]
       }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to