Change Flowfile Name

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

Change Flowfile Name

Rajesh Biswas

Hello NiFi Dev Team,

Would you please suggest how to change flow file name in Apache NiFi.

We have use UpdatAttribute processor with below configuration, would you please suggest regarding the same

 

Attribute Expression: ${filename:replace(${filename},"Medical"):append(${fromDate})}

 

Please help me with your thought

Thank you very much

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 


Virus-free. www.avast.com
Reply | Threaded
Open this post in threaded view
|

Re: Change Flowfile Name

Bryan Bende
You shouldn't need to use the "Delete Attributes Expression" since that is a regex indicating flow file attributes to remove, and you are not trying to remove anything here.

When you add properties, the name of the property is the attribute name you want to add/modify, and the value is the expression.

So you should have added "filename"  as the name of the property, and then your expression.

I can't really say if your expression is correct since it is not clear to me what your incoming filename looks like and what you want the outgoing file name to be.

If you want the filename to be "Medical2018-09-21" then your expression can just be "Medical${fromDate}", assuming there is a fromDate attribute already.


On Fri, Sep 21, 2018 at 9:39 AM Rajesh Biswas <[hidden email]> wrote:

Hello NiFi Dev Team,

Would you please suggest how to change flow file name in Apache NiFi.

We have use UpdatAttribute processor with below configuration, would you please suggest regarding the same

 

Attribute Expression: ${filename:replace(${filename},"Medical"):append(${fromDate})}

 

Please help me with your thought

Thank you very much

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 


Virus-free. www.avast.com
Reply | Threaded
Open this post in threaded view
|

RE: Change Flowfile Name

Rajesh Biswas
In reply to this post by Rajesh Biswas

Hello Bryan,

Thank you very much for your suggestion, it worked after following your suggestion.

I have one relative question here.

Is the Flow File name unique? Will it remain unique if we restart the NiFi service.

We do have a requirement to keep file name unique which we send to HTTP processor as Post request, the file became follow file content.

How to make sure the file name will always be unique?

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 

From: Rajesh Biswas [mailto:[hidden email]]
Sent: Friday, September 21, 2018 7:09 PM
To: [hidden email]; [hidden email]
Cc: [hidden email]; Joydeep Misra
Subject: Change Flowfile Name

 

Hello NiFi Dev Team,

Would you please suggest how to change flow file name in Apache NiFi.

We have use UpdatAttribute processor with below configuration, would you please suggest regarding the same

 

Attribute Expression: ${filename:replace(${filename},"Medical"):append(${fromDate})}

 

Please help me with your thought

Thank you very much

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 

 

Virus-free. www.avast.com

 

Reply | Threaded
Open this post in threaded view
|

Re: Change Flowfile Name

Bryan Bende
Filename is just a string attribute that could be anything, so it is not unique. Every flow file has an attribute called uuid which is unique.

NiFi could have a GetFile processor that picks up the same file over and over and could have 100 flow files all with the same filename, but with different uuids.


On Fri, Sep 21, 2018 at 3:25 PM Rajesh Biswas <[hidden email]> wrote:

Hello Bryan,

Thank you very much for your suggestion, it worked after following your suggestion.

I have one relative question here.

Is the Flow File name unique? Will it remain unique if we restart the NiFi service.

We do have a requirement to keep file name unique which we send to HTTP processor as Post request, the file became follow file content.

How to make sure the file name will always be unique?

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 

From: Rajesh Biswas [mailto:[hidden email]]
Sent: Friday, September 21, 2018 7:09 PM
To: [hidden email]; [hidden email]
Cc: [hidden email]; Joydeep Misra
Subject: Change Flowfile Name

 

Hello NiFi Dev Team,

Would you please suggest how to change flow file name in Apache NiFi.

We have use UpdatAttribute processor with below configuration, would you please suggest regarding the same

 

Attribute Expression: ${filename:replace(${filename},"Medical"):append(${fromDate})}

 

Please help me with your thought

Thank you very much

 

Thanks and Regards,

Rajesh Biswas | +91 9886433461 | www.bridgera.com

 

 

Virus-free. www.avast.com

 

Reply | Threaded
Open this post in threaded view
|

Re: Change Flowfile Name

Rajesh Biswas
Will be the UUID unique if we restart NiFi Server and create a new instance
of Nifi Server.
Would you please suggest a way to get the UUID and pass on as attribute

Thank you very much for your support.

Regards,
Rajesh Biswas

On Sat, Sep 22, 2018 at 1:24 AM Bryan Bende <[hidden email]> wrote:

> Filename is just a string attribute that could be anything, so it is not
> unique. Every flow file has an attribute called uuid which is unique.
>
> NiFi could have a GetFile processor that picks up the same file over and
> over and could have 100 flow files all with the same filename, but with
> different uuids.
>
>
> On Fri, Sep 21, 2018 at 3:25 PM Rajesh Biswas <[hidden email]>
> wrote:
>
>> Hello Bryan,
>>
>> Thank you very much for your suggestion, it worked after following your
>> suggestion.
>>
>> I have one relative question here.
>>
>> Is the Flow File name unique? Will it remain unique if we restart the
>> NiFi service.
>>
>> We do have a requirement to keep file name unique which we send to HTTP
>> processor as Post request, the file became follow file content.
>>
>> How to make sure the file name will always be unique?
>>
>>
>>
>> Thanks and Regards,
>>
>> *Rajesh Biswas* | +91 9886433461 | www.bridgera.com
>>
>>
>>
>> *From:* Rajesh Biswas [mailto:[hidden email]]
>> *Sent:* Friday, September 21, 2018 7:09 PM
>> *To:* [hidden email]; [hidden email]
>> *Cc:* [hidden email]; Joydeep Misra
>> *Subject:* Change Flowfile Name
>>
>>
>>
>> Hello NiFi Dev Team,
>>
>> Would you please suggest how to change flow file name in Apache NiFi.
>>
>> We have use UpdatAttribute processor with below configuration, would you
>> please suggest regarding the same
>>
>>
>>
>> Attribute Expression:
>> ${filename:replace(${filename},"Medical"):append(${fromDate})}
>>
>>
>>
>> Please help me with your thought
>>
>> Thank you very much
>>
>>
>>
>> Thanks and Regards,
>>
>> *Rajesh Biswas* | +91 9886433461 | www.bridgera.com
>>
>>
>>
>>
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>>
>> Virus-free. www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Change Flowfile Name

Bryan Bende
There is extremely low chance of a collision where the same UUID could get
generated again, but I'm not sure how realistic that is in practice [1].

There is already an attribute called uuid on every flow file which is
assigned when the flow file is created internally in NiFi and then can't be
changed.

So if you are using a similar expression from earlier in this thread, you
could set filename to "Medical-$[fromDate}-${uuid}" or something like that.

[1]
https://en.wikipedia.org/wiki/Universally_unique_identifier#Random_UUID_probability_of_duplicates

On Fri, Sep 21, 2018 at 4:00 PM Rajesh Biswas <[hidden email]>
wrote:

> Will be the UUID unique if we restart NiFi Server and create a new
> instance of Nifi Server.
> Would you please suggest a way to get the UUID and pass on as attribute
>
> Thank you very much for your support.
>
> Regards,
> Rajesh Biswas
>
> On Sat, Sep 22, 2018 at 1:24 AM Bryan Bende <[hidden email]> wrote:
>
>> Filename is just a string attribute that could be anything, so it is not
>> unique. Every flow file has an attribute called uuid which is unique.
>>
>> NiFi could have a GetFile processor that picks up the same file over and
>> over and could have 100 flow files all with the same filename, but with
>> different uuids.
>>
>>
>> On Fri, Sep 21, 2018 at 3:25 PM Rajesh Biswas <[hidden email]>
>> wrote:
>>
>>> Hello Bryan,
>>>
>>> Thank you very much for your suggestion, it worked after following your
>>> suggestion.
>>>
>>> I have one relative question here.
>>>
>>> Is the Flow File name unique? Will it remain unique if we restart the
>>> NiFi service.
>>>
>>> We do have a requirement to keep file name unique which we send to HTTP
>>> processor as Post request, the file became follow file content.
>>>
>>> How to make sure the file name will always be unique?
>>>
>>>
>>>
>>> Thanks and Regards,
>>>
>>> *Rajesh Biswas* | +91 9886433461 | www.bridgera.com
>>>
>>>
>>>
>>> *From:* Rajesh Biswas [mailto:[hidden email]]
>>> *Sent:* Friday, September 21, 2018 7:09 PM
>>> *To:* [hidden email]; [hidden email]
>>> *Cc:* [hidden email]; Joydeep Misra
>>> *Subject:* Change Flowfile Name
>>>
>>>
>>>
>>> Hello NiFi Dev Team,
>>>
>>> Would you please suggest how to change flow file name in Apache NiFi.
>>>
>>> We have use UpdatAttribute processor with below configuration, would you
>>> please suggest regarding the same
>>>
>>>
>>>
>>> Attribute Expression:
>>> ${filename:replace(${filename},"Medical"):append(${fromDate})}
>>>
>>>
>>>
>>> Please help me with your thought
>>>
>>> Thank you very much
>>>
>>>
>>>
>>> Thanks and Regards,
>>>
>>> *Rajesh Biswas* | +91 9886433461 | www.bridgera.com
>>>
>>>
>>>
>>>
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>>>
>>> Virus-free. www.avast.com
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>>>
>>>
>>>
>>