You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Michael Kobit <mk...@gmail.com> on 2015/09/02 22:06:20 UTC

'filename' not exposed as a property in 'PutFile' processor?

I was using the 'PutFile' processor, and noticed that you could not specify
the 'filename', and that it is always taken from the input flowfile's
'filename' attribute. I thought it would be useful if it exposed a property
to explicitly set the filename of the processor, defaulting to
`${filename}`.

Then I looked at `PutSFTP` and `PutHDFS`, and noticed that they also do not
expose the filename as a property. It looks like there might have been a
decision made to not expose it in these. As a workaround it seems like I
could put an `UpdateAttribute` processor before the `PutFile` that updates
'filename' (and possibly path), but I haven't tried. I wasn't sure if I was
getting into some anti-pattern here.

Is there a reason not to expose the filename as a property?

Re: 'filename' not exposed as a property in 'PutFile' processor?

Posted by Joe Witt <jo...@gmail.com>.
Michael,

Tweaking the 'filename' attribute of a flowfile by using
UpdateAttribute is actually the common pattern.

That said I can see what you're saying about why it would be nice to
specify what will be used as the 'filename' value for a given flow
file.  I could imagine each of those processors having support for a
'flowfile attribute' property on a processor which could be fed an
expression language statement.  That expression language by default
would be ${filename}.  I do think some very confusing cases could
occur with such a model but in any event it could be nice to let the
user control that.  If I have what you're suggesting correct please do
feel free to file a JIRA for that.

Thanks
Joe

On Wed, Sep 2, 2015 at 1:06 PM, Michael Kobit <mk...@gmail.com> wrote:
> I was using the 'PutFile' processor, and noticed that you could not specify
> the 'filename', and that it is always taken from the input flowfile's
> 'filename' attribute. I thought it would be useful if it exposed a property
> to explicitly set the filename of the processor, defaulting to
> `${filename}`.
>
> Then I looked at `PutSFTP` and `PutHDFS`, and noticed that they also do not
> expose the filename as a property. It looks like there might have been a
> decision made to not expose it in these. As a workaround it seems like I
> could put an `UpdateAttribute` processor before the `PutFile` that updates
> 'filename' (and possibly path), but I haven't tried. I wasn't sure if I was
> getting into some anti-pattern here.
>
> Is there a reason not to expose the filename as a property?