Hi all,

I would like to propose a new processor for the standard bundle and get
some feedback before opening a Jira and a PR.

*Problem.* ListFile has a single Input Directory and does not accept
incoming FlowFiles. When the files of interest live in many directories
that share a structure (e.g. /data/app/*/quarantine/missing_hash_file/*.gz,
one directory per tenant/user), the only option is to point ListFile at the
common root with Recurse Subdirectories and a Path Filter. This walks the
whole tree on every run, including large sibling directories that are never
relevant, and the Path Filter semantics have been a recurring source of
bugs (NIFI-7104, NIFI-9716, NIFI-9996). NIFI-6441 asks for a dynamic Input
Directory for the same reason.

As far as I understand from previous discussions, the main obstacle to
incoming connections on List* processors is state: with a different
directory per FlowFile there is no single key for "already listed" tracking.

*Proposal.* A new processor, ListFilesByPattern, that sidesteps the state
problem by being stateless by design:

   - Input requirement ALLOWED: timer-driven without an incoming
   connection, one listing per FlowFile when connected (properties evaluated
   against the incoming FlowFile attributes).
   - Glob pattern(s) instead of root + regex (e.g.
   /data/app/*/quarantine/missing_hash_file/*.{gz,zip}); traversal is
   driven by the pattern, so only matching directories are visited.
   - No "already listed" state: every run returns what currently matches,
   bounded by Minimum/Maximum File Age and Max Results. Deduplication, when
   needed, is left to the flow (moving files after processing,
   DetectDuplicate, etc.).
   - Output attributes compatible with ListFile (filename, path,
   absolute.path, file.lastModifiedTime, file.owner, …) plus the values
   captured by each wildcard segment (glob.1, glob.2, …).

MiNiFi C++ already has a glob-based FilePattern utility, so the concept is
not new to the project.

Our use case is a "sweeper" that, every few minutes, looks only at per-user
quarantine folders and checks whether a companion hash file has arrived.
Today we implement it with ExecuteGroovyScript.

Would this be welcome as a new processor in nifi-standard-processors? Any
concerns on naming, on staying stateless, or on scope (e.g. an optional
"companion files" check, which I would keep for a follow-up)?

Thanks, Vincenzo Lombardo

Reply via email to