Support Questions
Find answers, ask questions, and share your expertise

How to dynamically supply directory attribute value from a external file for GETFILE ?

Solved Go to solution
Highlighted

How to dynamically supply directory attribute value from a external file for GETFILE ?

I have a need to supply directory path for GETFILE processor from a file, which would be maintained as property file based on environment.. like landing,staging etc., Please help me if it is achievable and how? Can we use distributedCache ?

Also, Please provide DistributedMapCache examples.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

The Input Directory property of GetFile supports Expression Language so you can reference a system property like ${my.directory} and define my.directory in bootstrap.conf by adding another java arg like:

java.arg.15=-Dmy.directory=/foo

Then you can have different bootstrap files per environment.

View solution in original post

5 REPLIES 5
Highlighted

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

The Input Directory property of GetFile supports Expression Language so you can reference a system property like ${my.directory} and define my.directory in bootstrap.conf by adding another java arg like:

java.arg.15=-Dmy.directory=/foo

Then you can have different bootstrap files per environment.

View solution in original post

Highlighted

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

Thank you @Bryan Bende for quick reply!

In addition to the above question, how can we pass the file name if a template is created and needs to be used by different users and they want to pass their own path?

The idea here is to get file from local path and put it in HDFS. I have created a template, which should be used by different users based on their need by passing the required path for both GetFile, PutFile. As bootstrap is common config, how can we handle this scenario? Users might not be using the UI.. we will be supplying the RET call to start/stop the process group.

Highlighted

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

Is each user importing the template into a separate NiFi instance? or is there one NiFi instance with multiple users who all import the same template and want to retrieve files from different directories?

Highlighted

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

it is same NiFi instance with multiple users.

Re: How to dynamically supply directory attribute value from a external file for GETFILE ?

In that scenario there is always going to be something you have to set that is specific to the user. I think the best approach might be to use the REST API to change the value of GetFile's directory after the user imported the template and set it to the user's input directory.