Creating Custom Processor In Apache NifiApache NIFI “Execute Processor”Apache Nifi Execute Process ProcessorApache Nifi ExecuteSQL ProcessorApache NiFi tuning issuesHow to create a PutInfluxdb processor in Apache nifi?Apache nifi - how to implement “Continue if no records found in GetMongo processor”Nifi - Process the files based on count or time elapsed?Nifi Processor gets triggered twice for single Input flow fileNIFI - QueryDatabaseTable processor. How to query rows which is modified?Running python code in Apache Nifi ExecuteStreamCommand

Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?

Start from ones

Can you feel passing through the sound barrier in an F-16?

Are illustrations in novels frowned upon?

If the first law of thermodynamics ensures conservation of energy, why does it allow systems to lose energy?

Can realistic planetary invasion have any meaningful strategy?

Using `With[...]` with a list specification as a variable

Is “I am getting married with my sister” ambiguous?

Did a flight controller ever answer Flight with a no-go?

LeetCode: Pascal's Triangle C#

Most practical knots for hitching a line to an object while keeping the bitter end as tight as possible, without sag?

Why did this happen to Thanos's ships at the end of "Avengers: Endgame"?

Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?

What is the history of the university asylum law?

Fried gnocchi with spinach, bacon, cream sauce in a single pan

Does norwegian.no airline overbook flights?

What is the hex versus octal timeline?

Why in most German places is the church the tallest building?

How do I request a longer than normal leave of absence period for my wedding?

What is this symbol: semicircles facing eachother

How should I face my manager if I make a mistake because a senior coworker explained something incorrectly to me?

Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?

Why were movies shot on film shot at 24 frames per second?

What magic extends life or grants immortality?



Creating Custom Processor In Apache Nifi


Apache NIFI “Execute Processor”Apache Nifi Execute Process ProcessorApache Nifi ExecuteSQL ProcessorApache NiFi tuning issuesHow to create a PutInfluxdb processor in Apache nifi?Apache nifi - how to implement “Continue if no records found in GetMongo processor”Nifi - Process the files based on count or time elapsed?Nifi Processor gets triggered twice for single Input flow fileNIFI - QueryDatabaseTable processor. How to query rows which is modified?Running python code in Apache Nifi ExecuteStreamCommand






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am building an custom processor to process flow file , to process the flow file i need to read an CSV file from my local file system. I created an proerty descriptor CSV_PATH as follows



public static final PropertyDescriptor CSV_PATH = new 
PropertyDescriptor
.Builder().name("CSV Path")
.displayName("CSV Path")
.description("CSV Path Reader")
.required(true)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();



@Override

protected void init(final ProcessorInitializationContext context)

final List<PropertyDescriptor> descriptors = new
ArrayList<PropertyDescriptor>();

descriptors.add(JSON_PATH);

descriptors.add(CSV_PATH);

this.descriptors = Collections.unmodifiableList(descriptors);



final Set<Relationship> relationships = new HashSet<Relationship>();

relationships.add(SUCCESS);

this.relationships = Collections.unmodifiableSet(relationships);




Now I wants to get the value of CSV_PATH property set in UI while configuring processor. I am not able to get the CSV_PATH value. Also If I hardcode filepath in code then still I am not able to read CSV from local file system.










share|improve this question






























    0















    I am building an custom processor to process flow file , to process the flow file i need to read an CSV file from my local file system. I created an proerty descriptor CSV_PATH as follows



    public static final PropertyDescriptor CSV_PATH = new 
    PropertyDescriptor
    .Builder().name("CSV Path")
    .displayName("CSV Path")
    .description("CSV Path Reader")
    .required(true)
    .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    .build();



    @Override

    protected void init(final ProcessorInitializationContext context)

    final List<PropertyDescriptor> descriptors = new
    ArrayList<PropertyDescriptor>();

    descriptors.add(JSON_PATH);

    descriptors.add(CSV_PATH);

    this.descriptors = Collections.unmodifiableList(descriptors);



    final Set<Relationship> relationships = new HashSet<Relationship>();

    relationships.add(SUCCESS);

    this.relationships = Collections.unmodifiableSet(relationships);




    Now I wants to get the value of CSV_PATH property set in UI while configuring processor. I am not able to get the CSV_PATH value. Also If I hardcode filepath in code then still I am not able to read CSV from local file system.










    share|improve this question


























      0












      0








      0








      I am building an custom processor to process flow file , to process the flow file i need to read an CSV file from my local file system. I created an proerty descriptor CSV_PATH as follows



      public static final PropertyDescriptor CSV_PATH = new 
      PropertyDescriptor
      .Builder().name("CSV Path")
      .displayName("CSV Path")
      .description("CSV Path Reader")
      .required(true)
      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
      .build();



      @Override

      protected void init(final ProcessorInitializationContext context)

      final List<PropertyDescriptor> descriptors = new
      ArrayList<PropertyDescriptor>();

      descriptors.add(JSON_PATH);

      descriptors.add(CSV_PATH);

      this.descriptors = Collections.unmodifiableList(descriptors);



      final Set<Relationship> relationships = new HashSet<Relationship>();

      relationships.add(SUCCESS);

      this.relationships = Collections.unmodifiableSet(relationships);




      Now I wants to get the value of CSV_PATH property set in UI while configuring processor. I am not able to get the CSV_PATH value. Also If I hardcode filepath in code then still I am not able to read CSV from local file system.










      share|improve this question














      I am building an custom processor to process flow file , to process the flow file i need to read an CSV file from my local file system. I created an proerty descriptor CSV_PATH as follows



      public static final PropertyDescriptor CSV_PATH = new 
      PropertyDescriptor
      .Builder().name("CSV Path")
      .displayName("CSV Path")
      .description("CSV Path Reader")
      .required(true)
      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
      .build();



      @Override

      protected void init(final ProcessorInitializationContext context)

      final List<PropertyDescriptor> descriptors = new
      ArrayList<PropertyDescriptor>();

      descriptors.add(JSON_PATH);

      descriptors.add(CSV_PATH);

      this.descriptors = Collections.unmodifiableList(descriptors);



      final Set<Relationship> relationships = new HashSet<Relationship>();

      relationships.add(SUCCESS);

      this.relationships = Collections.unmodifiableSet(relationships);




      Now I wants to get the value of CSV_PATH property set in UI while configuring processor. I am not able to get the CSV_PATH value. Also If I hardcode filepath in code then still I am not able to read CSV from local file system.







      apache-nifi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 16:46









      codercoder

      1111 silver badge19 bronze badges




      1111 silver badge19 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          2















          You want to use the following code to retrieve the value of the PropertyDescriptor from the ProcessContext:



          @Override
          public void onTrigger(final ProcessContext context, final ProcessSession session)
          FlowFile flowFile = session.get();
          if (flowFile == null)
          return;


          final String csvPath = context.getProperty(CSV_PATH).getValue();

          // Do something with csvPath




          If you decide to support NiFi Expression Language in that property descriptor, you will also want to evaluate for that:



          final String csvPath = context.getProperty(CSV_PATH).evaluateAttributeExpressions().getValue();



          There are additional method overrides for that, including flowfile attributes, variable registry, custom decorators, etc.



          This is documented in the Apache NiFi Developer's Guide. I recently did a presentation at Dataworks Summit Barcelona 2019 covering custom processor development with some best practices included and examples that may be helpful. You can also look at any existing processor in the NiFi codebase to see examples.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55382479%2fcreating-custom-processor-in-apache-nifi%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2















            You want to use the following code to retrieve the value of the PropertyDescriptor from the ProcessContext:



            @Override
            public void onTrigger(final ProcessContext context, final ProcessSession session)
            FlowFile flowFile = session.get();
            if (flowFile == null)
            return;


            final String csvPath = context.getProperty(CSV_PATH).getValue();

            // Do something with csvPath




            If you decide to support NiFi Expression Language in that property descriptor, you will also want to evaluate for that:



            final String csvPath = context.getProperty(CSV_PATH).evaluateAttributeExpressions().getValue();



            There are additional method overrides for that, including flowfile attributes, variable registry, custom decorators, etc.



            This is documented in the Apache NiFi Developer's Guide. I recently did a presentation at Dataworks Summit Barcelona 2019 covering custom processor development with some best practices included and examples that may be helpful. You can also look at any existing processor in the NiFi codebase to see examples.






            share|improve this answer





























              2















              You want to use the following code to retrieve the value of the PropertyDescriptor from the ProcessContext:



              @Override
              public void onTrigger(final ProcessContext context, final ProcessSession session)
              FlowFile flowFile = session.get();
              if (flowFile == null)
              return;


              final String csvPath = context.getProperty(CSV_PATH).getValue();

              // Do something with csvPath




              If you decide to support NiFi Expression Language in that property descriptor, you will also want to evaluate for that:



              final String csvPath = context.getProperty(CSV_PATH).evaluateAttributeExpressions().getValue();



              There are additional method overrides for that, including flowfile attributes, variable registry, custom decorators, etc.



              This is documented in the Apache NiFi Developer's Guide. I recently did a presentation at Dataworks Summit Barcelona 2019 covering custom processor development with some best practices included and examples that may be helpful. You can also look at any existing processor in the NiFi codebase to see examples.






              share|improve this answer



























                2














                2










                2









                You want to use the following code to retrieve the value of the PropertyDescriptor from the ProcessContext:



                @Override
                public void onTrigger(final ProcessContext context, final ProcessSession session)
                FlowFile flowFile = session.get();
                if (flowFile == null)
                return;


                final String csvPath = context.getProperty(CSV_PATH).getValue();

                // Do something with csvPath




                If you decide to support NiFi Expression Language in that property descriptor, you will also want to evaluate for that:



                final String csvPath = context.getProperty(CSV_PATH).evaluateAttributeExpressions().getValue();



                There are additional method overrides for that, including flowfile attributes, variable registry, custom decorators, etc.



                This is documented in the Apache NiFi Developer's Guide. I recently did a presentation at Dataworks Summit Barcelona 2019 covering custom processor development with some best practices included and examples that may be helpful. You can also look at any existing processor in the NiFi codebase to see examples.






                share|improve this answer













                You want to use the following code to retrieve the value of the PropertyDescriptor from the ProcessContext:



                @Override
                public void onTrigger(final ProcessContext context, final ProcessSession session)
                FlowFile flowFile = session.get();
                if (flowFile == null)
                return;


                final String csvPath = context.getProperty(CSV_PATH).getValue();

                // Do something with csvPath




                If you decide to support NiFi Expression Language in that property descriptor, you will also want to evaluate for that:



                final String csvPath = context.getProperty(CSV_PATH).evaluateAttributeExpressions().getValue();



                There are additional method overrides for that, including flowfile attributes, variable registry, custom decorators, etc.



                This is documented in the Apache NiFi Developer's Guide. I recently did a presentation at Dataworks Summit Barcelona 2019 covering custom processor development with some best practices included and examples that may be helpful. You can also look at any existing processor in the NiFi codebase to see examples.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 18:01









                AndyAndy

                9,7601 gold badge25 silver badges52 bronze badges




                9,7601 gold badge25 silver badges52 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55382479%2fcreating-custom-processor-in-apache-nifi%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript