Adding properties

classic Classic list List threaded Threaded
2 messages Options
plj
Reply | Threaded
Open this post in threaded view
|

Adding properties

plj
Howdy,

  I've been away from NiFi for awhile and have forgotten how to do some things.  I'm using the GetMongo processor (1.2) and I want to use the 'Mongo Collection Name' property later .  How do I do that?
  I've tried adding a property to the GetMongo processor but it always complaints that it isn't legal.  I added the property myproperty and set the value to collectionname.  I get the error:

"'myproperty' validated against 'collectionname' is invalid because 'myproperty' is not a supported property"

Eventually I would like to save the results from the GetMongo to a file.  I would like the filename to be the collectionname_date_time.  How should I be doing this.

Thank for your help
Reply | Threaded
Open this post in threaded view
|

Re: Adding properties

Koji Kawamura-2
Hi,

By looking at GetMongo source code and its docs, I believe it doesn't
write specified 'Mongo Collection Name' to any attribute of outgoing
FlowFiles. So you wouldn't be able to refer it from other processors
at downstream of your flow.
Please file a JIRA if this is needed.
https://issues.apache.org/jira/projects/NIFI

Usually, UpdateAttribute is used to set a 'filename' FlowFile
attribute using NiFi Attribute Expression Language, e.g. Add
'filename' dynamic property to UpdateAttribute with setting such as
"${collectionname}_${now():format('yyyyMMdd_HHmmss')}". But
collectionname is not available as I mentioned before.

The reason you get "myproperty is invalid" error is because GetMongo
doesn't support any dynamic properties.

Hope this helps.

Thanks,
Koji

On Thu, Jul 13, 2017 at 3:05 AM, plj <[hidden email]> wrote:

> Howdy,
>
>   I've been away from NiFi for awhile and have forgotten how to do some
> things.  I'm using the GetMongo processor (1.2) and I want to use the 'Mongo
> Collection Name' property later .  How do I do that?
>   I've tried adding a property to the GetMongo processor but it always
> complaints that it isn't legal.  I added the property myproperty and set the
> value to collectionname.  I get the error:
>
> "'myproperty' validated against 'collectionname' is invalid because
> 'myproperty' is not a supported property"
>
> Eventually I would like to save the results from the GetMongo to a file.  I
> would like the filename to be the collectionname_date_time.  How should I be
> doing this.
>
> Thank for your help
>
>
>
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Adding-properties-tp16413.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.