Created on 11-06-2019 06:57 AM - last edited on 11-06-2019 08:29 AM by cjervis
Hi all,
Is it possible to save the uuid of a processor in an attribute?
For example,
i have the processor ExecuteSQL, which has this uuid
I wish I could save the uuid like this:
id = $ .uuid
It's possible?
Thanks!
Created 11-06-2019 08:43 AM
"filename" is also another FlowFile attribute that is created by default on every FlowFile that is created in NiFi. With some processors a filename can not be derived from or created based in the content that is received.
ExecuteSQL (no inbound connection) and generateFlowFile processors are good examples here.
In case like this, NiFi will just default to using the FlowFile's uuid as the filename also.
Your statement "attribute "filename" that generated that executesql is "inherited" in all processors" is not accurate. Processors do not inherit attributes.
A NiFi FlowFile exists of two parts:
1. FlowFile attributes/metadata -- These FlowFile attributes reside in heap memory and are also stored in the flowfile_repository. It is these attributes which "flow" from one processor component to another in you dataflow you build on the canvas. Processors then have access to these FlowFile Attributes when they execute against a given FlowFile from the inbound connection. Some processors as part of their execution will create additional attributes on a FlowFile before it is committed to the processor relationship that is assigned to a outbound connection.
2. FlowFile Content -- The actual content of a FlowFile is written to a claim in the content_repository. It is only access as needed by a processor. It does not reside in heap memory unless a processor needs to do so to perform its function.
These FlowFile attributes can be changed as your FlowFile passes through different processors, but they belong to the FlowFile and not the processors at all. So there is nothing you need to "preserve/save" in most cases.
Hope this adds some clarity,
Matt
Created 11-06-2019 07:09 AM
The unique uuid assigned to a NiFi processor component is not exposed to NiFi Expression Language (EL).
So it is not something you can accomplish dynamically via the NiFi EL.
What I a confused by is your screenshot. Your screenshot does not show the UUID of the processor. It is showing the unique UUID assigned to a FlowFile in position 1 on a connection.
If what you are really looking for is the FlowFile UUID and not the processor component UUID, then that can be access via the NiFI EL.
The uuid is assigned by default to an attribute "uuid" (all lowercase) on every FlowFile that is created in NiFi. It can be accessed using ${uuid} in NiFi EL. If you wanted to preserve that uuid into another FlowFile Attribute, you could use UpdateAttribute
property: Value:
id ${uuid}
Thanks,
Matt
Created 11-06-2019 08:17 AM
You are right.
I'm still a neophyte in Nifi.
However in the stream I saw that the attribute "filename" that generated that executesql is "inherited" in all processors.
Can I save that too?
Created 11-06-2019 08:43 AM
"filename" is also another FlowFile attribute that is created by default on every FlowFile that is created in NiFi. With some processors a filename can not be derived from or created based in the content that is received.
ExecuteSQL (no inbound connection) and generateFlowFile processors are good examples here.
In case like this, NiFi will just default to using the FlowFile's uuid as the filename also.
Your statement "attribute "filename" that generated that executesql is "inherited" in all processors" is not accurate. Processors do not inherit attributes.
A NiFi FlowFile exists of two parts:
1. FlowFile attributes/metadata -- These FlowFile attributes reside in heap memory and are also stored in the flowfile_repository. It is these attributes which "flow" from one processor component to another in you dataflow you build on the canvas. Processors then have access to these FlowFile Attributes when they execute against a given FlowFile from the inbound connection. Some processors as part of their execution will create additional attributes on a FlowFile before it is committed to the processor relationship that is assigned to a outbound connection.
2. FlowFile Content -- The actual content of a FlowFile is written to a claim in the content_repository. It is only access as needed by a processor. It does not reside in heap memory unless a processor needs to do so to perform its function.
These FlowFile attributes can be changed as your FlowFile passes through different processors, but they belong to the FlowFile and not the processors at all. So there is nothing you need to "preserve/save" in most cases.
Hope this adds some clarity,
Matt