[ 
https://issues.apache.org/jira/browse/NIFI-16457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vincenzo Lombardo updated NIFI-16457:
-------------------------------------
    Status: Patch Available  (was: Open)

> Add C2 CLEAR CONNECTION operation to MiNiFi
> -------------------------------------------
>
>                 Key: NIFI-16457
>                 URL: https://issues.apache.org/jira/browse/NIFI-16457
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: MiNiFi
>            Reporter: Vincenzo Lombardo
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h3. Problem
> The C2 protocol defines {{OperationType.CLEAR}} with 
> {{OperandType.CONNECTION}} as its only supported operand 
> ({{c2-protocol-api}}), but MiNiFi Java does not register any 
> {{C2OperationHandler}} for it. As a result:
> * a C2 server has no way to empty a connection queue on an agent (the 
> equivalent of "Empty Queue" on the NiFi canvas), for example to recover an 
> agent blocked by back pressure or by FlowFiles that cannot be processed
> * an operation CLEAR / CONNECTION sent to an agent is never acknowledged
> The only current workaround is pushing a new flow configuration or accessing 
> the host directly.
> h3. Proposed change
> Implement the operation with the same structure used for processor START/STOP 
> -  (NIFI-15017):
> * {{ConnectionQueueStrategy}} interface and 
> {{ClearConnectionOperationHandler}} in {{c2-client-service}}; the handler 
> reads the {{connectionId}} argument and returns NOT_APPLIED when it is missing
> * {{DefaultConnectionQueueStrategy}} in {{minifi-framework-core}}: looks up 
> the connection through {{FlowManager}} and calls 
> {{FlowFileQueue.dropFlowFiles(...)}}, the same mechanism 
> {{DefaultUpdateConfigurationStrategy}} already uses to empty queues removed 
> by a flow update
> * the drop request is asynchronous, so the strategy waits for its completion 
> up to a timeout (30 seconds):
> ** FULLY_APPLIED when the drop request completes
> ** PARTIALLY_APPLIED when it is still running after the timeout
> ** NOT_APPLIED when the connection does not exist or the drop request fails
> * register the handler in {{C2NifiClientService}}, so CLEAR / CONNECTION is 
> advertised in the agent's supported operations
> Example operation:
> {code:json}
> {
>   "identifier": "op-1",
>   "operation": "CLEAR",
>   "operand": "CONNECTION",
>   "args": { "connectionId": "<connection instance identifier>" }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to