You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by idioma <co...@gmail.com> on 2016/04/14 17:20:47 UTC

Multiple nar/custom processors: advisable directory structure

Hi,
currently, I have one custom processor + test in a similar folder structure
in my IDE (IntelliJ):

-CustomProcessors
   -nifi-myprocessor-nar
   -nifi-myprocessor
      -src
          -main
              -java
                  MyProcessor.java
      -test
          -MyProcessorTest.java

I am now in the process to add another processor, what is the best approach?
Shall I have 2 new folders for the nar and one containing the actual
processor? I would like to generate a basic structure for the processor (as
it describes here:
https://community.hortonworks.com/articles/4318/build-custom-nifi-processor.html).
Is that advisable when adding another custom processor?

Thanks,




--
View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.

Re: Multiple nar/custom processors: advisable directory structure

Posted by idioma <co...@gmail.com>.
Yes, but eventually I have resorted to copy and pasted the existing nar and
processor folders and changing references in the pom.xml and in the
resources folder.

Thank you!



--
View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089p9223.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.

Re: Multiple nar/custom processors: advisable directory structure

Posted by Oleg Zhurakousky <oz...@hortonworks.com>.
Hmm, I am not sure I follow completely. 
You’ve described the approach you followed (i assume successfully) to create a NAR. Are you asking if you should follow the same approach for creating another NAR?

Cheers
Oleg

> On Apr 15, 2016, at 3:16 AM, idioma <co...@gmail.com> wrote:
> 
> Oleg,
> thanks for your reply. No, in this case it is not strictly related to my
> first processor so I felt myself it should go in a separate NAR. I am
> probably still unsure on how to generate it. For my first one, I have
> created an empty folder and then run mvn archetype:generate, then after
> filling in all information I have run maven clean install. Will this be the
> very same process for my second/third/additional processor(s)? 
> 
> Thank you so much for your help. 
> 
> 
> 
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089p9108.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.
> 


Re: Multiple nar/custom processors: advisable directory structure

Posted by idioma <co...@gmail.com>.
Oleg,
thanks for your reply. No, in this case it is not strictly related to my
first processor so I felt myself it should go in a separate NAR. I am
probably still unsure on how to generate it. For my first one, I have
created an empty folder and then run mvn archetype:generate, then after
filling in all information I have run maven clean install. Will this be the
very same process for my second/third/additional processor(s)? 

Thank you so much for your help. 



--
View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089p9108.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.

Re: Multiple nar/custom processors: advisable directory structure

Posted by Oleg Zhurakousky <oz...@hortonworks.com>.
Unfortunately I’ll answer the question with the question ;)
Is the additional processor related to the previous one? For example we have a single bundle with more then one processor (e.g., Get/PutSomething). If so then you can create another Processor in the same bundle (NAR).
If it is not then you should start a separate NAR.

Keep in mind that each NAR provides a class loader isolation, so another way of looking at this is do the two+ processor require different class path?
Does that help?

Cheers
Oleg

> On Apr 14, 2016, at 11:20 AM, idioma <co...@gmail.com> wrote:
> 
> Hi,
> currently, I have one custom processor + test in a similar folder structure
> in my IDE (IntelliJ):
> 
> -CustomProcessors
>   -nifi-myprocessor-nar
>   -nifi-myprocessor
>      -src
>          -main
>              -java
>                  MyProcessor.java
>      -test
>          -MyProcessorTest.java
> 
> I am now in the process to add another processor, what is the best approach?
> Shall I have 2 new folders for the nar and one containing the actual
> processor? I would like to generate a basic structure for the processor (as
> it describes here:
> https://community.hortonworks.com/articles/4318/build-custom-nifi-processor.html).
> Is that advisable when adding another custom processor?
> 
> Thanks,
> 
> 
> 
> 
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.
> 


Re: Multiple nar/custom processors: advisable directory structure

Posted by Joe Witt <jo...@gmail.com>.
Hello

You can certainly group your processors together in the same module.
No need to make different module/directories.  You are free to use
whatever package naming structure you need under there.

When deciding whether to include things in the same nar or not
consider their shared dependencies and if there is value in them be
together (they use the same dependencies) or separate (they use
different ones or are likely to diverge).

Thanks
Joe

On Thu, Apr 14, 2016 at 12:27 PM, Russell Bateman
<ru...@perfectsearchcorp.com> wrote:
> Welcome Idioma...
>
> 1) You'll want to subsume your new processors under deeper Java packages
> (you probably knew that).
>
> 2) In addition to the Java code, you'll add:
> -src
>   -main
>     - resources
>       - META-INF
>         - services
>           - org.apache.nifi.processor.Processor
> containing a list of the package paths to each of your new processors.
>
> Does this help?
>
>
> On 04/14/2016 09:20 AM, idioma wrote:
>>
>> Hi,
>> currently, I have one custom processor + test in a similar folder
>> structure
>> in my IDE (IntelliJ):
>>
>> -CustomProcessors
>>     -nifi-myprocessor-nar
>>     -nifi-myprocessor
>>        -src
>>            -main
>>                -java
>>                    MyProcessor.java
>>        -test
>>            -MyProcessorTest.java
>>
>> I am now in the process to add another processor, what is the best
>> approach?
>> Shall I have 2 new folders for the nar and one containing the actual
>> processor? I would like to generate a basic structure for the processor
>> (as
>> it describes here:
>>
>> https://community.hortonworks.com/articles/4318/build-custom-nifi-processor.html).
>> Is that advisable when adding another custom processor?
>>
>> Thanks,
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089.html
>> Sent from the Apache NiFi Developer List mailing list archive at
>> Nabble.com.
>
>

Re: Multiple nar/custom processors: advisable directory structure

Posted by Russell Bateman <ru...@perfectsearchcorp.com>.
Welcome Idioma...

1) You'll want to subsume your new processors under deeper Java packages 
(you probably knew that).

2) In addition to the Java code, you'll add:
-src
   -main
     - resources
       - META-INF
         - services
           - org.apache.nifi.processor.Processor
containing a list of the package paths to each of your new processors.

Does this help?

On 04/14/2016 09:20 AM, idioma wrote:
> Hi,
> currently, I have one custom processor + test in a similar folder structure
> in my IDE (IntelliJ):
>
> -CustomProcessors
>     -nifi-myprocessor-nar
>     -nifi-myprocessor
>        -src
>            -main
>                -java
>                    MyProcessor.java
>        -test
>            -MyProcessorTest.java
>
> I am now in the process to add another processor, what is the best approach?
> Shall I have 2 new folders for the nar and one containing the actual
> processor? I would like to generate a basic structure for the processor (as
> it describes here:
> https://community.hortonworks.com/articles/4318/build-custom-nifi-processor.html).
> Is that advisable when adding another custom processor?
>
> Thanks,
>
>
>
>
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Multiple-nar-custom-processors-advisable-directory-structure-tp9089.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.