Skip to main content
manishg
Gold ⭐️
March 20, 2024
Solved

Routing from RouteOnAttribute to GetFile

I have to create a connection from RouteOnAttribute  processor to GetFile processor based on value of an attribute which I have set in processor preceding RouteOnAttribute .

But I am unable to do so on NiFi ui. Connection dialogbox jut doesn't appear.

What am I missing?

SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
March 20, 2024

Ok, I think I know what you mean now.  Basically the GetFile is designed not to take any incoming connection as you can see in the processor documentation:

SAMSAL_1-1710925296183.png

The reason  such restriction applies depend on how the processor works. The GetFile is designed as a trigger processor and it executes every time a file is placed in the target path, so providing an incoming relationship (wither through routeOnAttribute or any other processor) will break this rule because that means the GetFile will only work and Get the file when upper stream processor triggers that via sending flowfile which is not what this processor is designed to do. What you need is FetchFile processor given that you know the file you are looking for because this processor takes the full file path and not just a directory.

 

3 replies

SAMSAL
Platinum ⭐️⭐️⭐️
March 20, 2024

Hi , can you provide screenshot of the routeonattribute processor properties and relationship tabls configurations ? Also if you can provide a screenshot of the data flow and highlight what is missing?  that would be very helpful to the community to pin point what exactly the problem is.

Translate
manishg
manishgAuthor
Gold ⭐️
March 20, 2024

This is RouteOnAttribute processor. As you can see I have 2 properties defined. I want to use fileTransfer property to route to GetFile processor.

manishg_0-1710924159787.png

And this is connection dialog box for one of the existing connections, and it lists 'fileTransfer' as a relationship.

manishg_1-1710924252034.png

 

Translate
SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
March 20, 2024

Ok, I think I know what you mean now.  Basically the GetFile is designed not to take any incoming connection as you can see in the processor documentation:

SAMSAL_1-1710925296183.png

The reason  such restriction applies depend on how the processor works. The GetFile is designed as a trigger processor and it executes every time a file is placed in the target path, so providing an incoming relationship (wither through routeOnAttribute or any other processor) will break this rule because that means the GetFile will only work and Get the file when upper stream processor triggers that via sending flowfile which is not what this processor is designed to do. What you need is FetchFile processor given that you know the file you are looking for because this processor takes the full file path and not just a directory.

 

Translate