For inotify, I would personally be in favor of a separate "WatchFile"
processor that would presumably utilize the java.nio.file.WatchService
class.

In this case, I do think it's a separate processor. Because the semantics
are different enough from a "List" concept, which is more like a proxy for
the "ls" command. The WatchService can be configured for file events like
"Create" or "Delete" in a target directory. So I think there would be
enough divergence from the ListFile processor to justify its own thing.

On Mon, Nov 30, 2026 at 5:23 PM Marton Szasz via dev <[email protected]>
wrote:

> Since the FilePattern utility from MiNiFi C++ was mentioned: it's
> currently used for extension loading, but not in any processor code. The
> extension load path in minifi.properties allows globs like
> `../extensions/libminifi*.so`, and the FilePattern utility implements
> this glob matching. It only handles `*`, `**`, and `?`, but not `{A,B}`,
> which I recognize as a bash brace expansion. I suspect that for this use
> case (and most other similar ones), a more powerful file path matching
> would be necessary, so I'd suggest considering a proper extended regex.
>
> In normal ListFile, in the past I've been thinking of using inotify and
> similar filesystem event watcher APIs to avoid recursively walking the
> entire tree. I believe all modern filesystems support this. While this
> doesn't avoid the problem of watching potentially uninteresting
> neighboring subdirectories, but it can cut down on the CPU use required,
> maybe enough to make the existing ListFile processor with a Path Filter
> viable for most similar use cases. This still wouldn't make the
> processor stateless, since it has to avoid listing all older files again
> on restart.
>
> I'm not sure which design is the ideal one (if any), I just wanted to
> share my thoughts.
>
> Marton
>
> On 12/1/26 12:11 AM, Adam Taft wrote:
> > Hi Vincenzo,
> >
> > These are good feature suggestions. I'm wondering if they justify a new
> > processor though? Have you evaluated applying these features to the
> > existing ListFile processor?
> >
> > I feel like the three primary goals of your processor could be realized
> as
> > updates to the existing ListFile.
> >
> > - Input Requirement ALLOWED - Going from FORBIDDEN to ALLOWED should be
> > backwards compatible.
> > - Glob Pattern - Could be specified as a "type" for the FileFilter
> > property. Defaults to a regex pattern for compatibility, but adds Glob as
> > an option.
> > - State Tracking - Could be specified as disabled (or a new noop tracking
> > strategy introduced)
> >
> > I almost always like the idea of "ALLOWED" for input requirement, so that
> > actions can be driven from upstream processors. This has always seemed to
> > be a more powerful triggering concept in NiFi, from my experience. So
> > changing the input requirement of the existing processor definitely gets
> my
> > vote here.
> >
> > Considering the above, what are the negatives of modifying the existing
> > processor?
> >
> > /Adam
> >
> > On Thu, Nov 26, 2026 at 5:31 AM VINCENZO LOMBARDO <
> > [email protected]> wrote:
> >
> >> 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