Get ProcessGroup from processorHow to use NiFi ExecuteScript processor with Python?NiFi fetchFile processor doesn't allow dynamic attributesHow to update the “Replacement Value” in ReplaceText Processor using Rest API?Is it possible to get the ID of a processor/connector in apache NiFi using the rest API?Stopping processor in secure NiFiNifi: Route on Attribute processor to wrong processorHow to start ALL processorsNifi Processor to run multiple instanceNiFi getHTTP or invokeHTTP which processor to use?How to configure ExecuteScript processor in NIfi to use JyNI package to enable libraries using numpy?

One verb to replace 'be a member of' a club

Was the old ablative pronoun "med" or "mēd"?

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Is it "common practice in Fourier transform spectroscopy to multiply the measured interferogram by an apodizing function"? If so, why?

What is the most common color to indicate the input-field is disabled?

Can a virus destroy the BIOS of a modern computer?

Ambiguity in the definition of entropy

Can someone clarify Hamming's notion of important problems in relation to modern academia?

Description list Formatting using enumitem

Is there an online compendium of Rav Moshe teshuvos in English that exists?

Is this answer explanation correct?

How to stretch the corners of this image so that it looks like a perfect rectangle?

How to install cross-compiler on Ubuntu 18.04?

In the UK, is it possible to get a referendum by a court decision?

How obscure is the use of 令 in 令和?

Do creatures with a listed speed of "0 ft., fly 30 ft. (hover)" ever touch the ground?

Why was the shrink from 8″ made only to 5.25″ and not smaller (4″ or less)

How can saying a song's name be a copyright violation?

Expand and Contract

Processor speed limited at 0.4 Ghz

How could indestructible materials be used in power generation?

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

How seriously should I take size and weight limits of hand luggage?



Get ProcessGroup from processor


How to use NiFi ExecuteScript processor with Python?NiFi fetchFile processor doesn't allow dynamic attributesHow to update the “Replacement Value” in ReplaceText Processor using Rest API?Is it possible to get the ID of a processor/connector in apache NiFi using the rest API?Stopping processor in secure NiFiNifi: Route on Attribute processor to wrong processorHow to start ALL processorsNifi Processor to run multiple instanceNiFi getHTTP or invokeHTTP which processor to use?How to configure ExecuteScript processor in NIfi to use JyNI package to enable libraries using numpy?













2















Is there an API to get a ProcessGroup by id from a custom processor or an ExecuteScript processor?



I know that it is possible by using the REST-API, but for security reasons, I don't have the chance to use the credentials to invoke the API from a service.



Regards










share|improve this question


























    2















    Is there an API to get a ProcessGroup by id from a custom processor or an ExecuteScript processor?



    I know that it is possible by using the REST-API, but for security reasons, I don't have the chance to use the credentials to invoke the API from a service.



    Regards










    share|improve this question
























      2












      2








      2








      Is there an API to get a ProcessGroup by id from a custom processor or an ExecuteScript processor?



      I know that it is possible by using the REST-API, but for security reasons, I don't have the chance to use the credentials to invoke the API from a service.



      Regards










      share|improve this question














      Is there an API to get a ProcessGroup by id from a custom processor or an ExecuteScript processor?



      I know that it is possible by using the REST-API, but for security reasons, I don't have the chance to use the credentials to invoke the API from a service.



      Regards







      apache-nifi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 20:46









      AndrésAndrés

      161




      161






















          1 Answer
          1






          active

          oldest

          votes


















          1














          If you use a InvokeScriptedProcessor using groovy you can use



          context.procNode.processGroup


          from the ProcessContext
          If you want to extract all the parents in a breadcrum way, you can use this:



          import groovy.json.*;
          import org.apache.nifi.groups.*;

          class GroovyProcessor implements Processor

          def REL_SUCCESS = new Relationship.Builder()
          .name("success")
          .description('FlowFiles that were successfully processed are routed here').build()

          def ComponentLog log

          @Override
          void initialize(ProcessorInitializationContext context)
          log = context.logger


          @Override
          Set<Relationship> getRelationships()
          return [REL_SUCCESS] as Set


          void executeScript(ProcessSession session, ProcessContext context)
          def flowFile = session.get()
          if (!flowFile) return

          def breadcrumb = getBreadCrumb(context.procNode.processGroup) + '->' + context.getName()
          flowFile = session.putAttribute(flowFile, 'breadcrumb', breadcrumb)

          // transfer
          session.transfer(flowFile, this.REL_SUCCESS)


          // Recursive funtion that gets the breadcrumb
          String getBreadCrumb(processGroup)
          def breadCrumb = ''
          if(processGroup.parent != null)
          breadCrumb = getBreadCrumb(processGroup.parent) + '->'

          return breadCrumb + processGroup.name


          @Override
          void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
          def session = sessionFactory.createSession()
          try
          executeScript( session, context)
          session.commit()

          catch (final Throwable t)
          log.error(' failed to process due to ; rolling back session', [this, t] as Object[])
          session.rollback(true)
          throw t



          @Override
          PropertyDescriptor getPropertyDescriptor(String name) null

          @Override
          List<PropertyDescriptor> getPropertyDescriptors()
          return [] as List



          @Override
          void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)

          @Override
          Collection<ValidationResult> validate(ValidationContext context) null

          @Override
          String getIdentifier() null


          processor = new GroovyProcessor()





          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%2f55288989%2fget-processgroup-from-processor%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









            1














            If you use a InvokeScriptedProcessor using groovy you can use



            context.procNode.processGroup


            from the ProcessContext
            If you want to extract all the parents in a breadcrum way, you can use this:



            import groovy.json.*;
            import org.apache.nifi.groups.*;

            class GroovyProcessor implements Processor

            def REL_SUCCESS = new Relationship.Builder()
            .name("success")
            .description('FlowFiles that were successfully processed are routed here').build()

            def ComponentLog log

            @Override
            void initialize(ProcessorInitializationContext context)
            log = context.logger


            @Override
            Set<Relationship> getRelationships()
            return [REL_SUCCESS] as Set


            void executeScript(ProcessSession session, ProcessContext context)
            def flowFile = session.get()
            if (!flowFile) return

            def breadcrumb = getBreadCrumb(context.procNode.processGroup) + '->' + context.getName()
            flowFile = session.putAttribute(flowFile, 'breadcrumb', breadcrumb)

            // transfer
            session.transfer(flowFile, this.REL_SUCCESS)


            // Recursive funtion that gets the breadcrumb
            String getBreadCrumb(processGroup)
            def breadCrumb = ''
            if(processGroup.parent != null)
            breadCrumb = getBreadCrumb(processGroup.parent) + '->'

            return breadCrumb + processGroup.name


            @Override
            void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
            def session = sessionFactory.createSession()
            try
            executeScript( session, context)
            session.commit()

            catch (final Throwable t)
            log.error(' failed to process due to ; rolling back session', [this, t] as Object[])
            session.rollback(true)
            throw t



            @Override
            PropertyDescriptor getPropertyDescriptor(String name) null

            @Override
            List<PropertyDescriptor> getPropertyDescriptors()
            return [] as List



            @Override
            void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)

            @Override
            Collection<ValidationResult> validate(ValidationContext context) null

            @Override
            String getIdentifier() null


            processor = new GroovyProcessor()





            share|improve this answer



























              1














              If you use a InvokeScriptedProcessor using groovy you can use



              context.procNode.processGroup


              from the ProcessContext
              If you want to extract all the parents in a breadcrum way, you can use this:



              import groovy.json.*;
              import org.apache.nifi.groups.*;

              class GroovyProcessor implements Processor

              def REL_SUCCESS = new Relationship.Builder()
              .name("success")
              .description('FlowFiles that were successfully processed are routed here').build()

              def ComponentLog log

              @Override
              void initialize(ProcessorInitializationContext context)
              log = context.logger


              @Override
              Set<Relationship> getRelationships()
              return [REL_SUCCESS] as Set


              void executeScript(ProcessSession session, ProcessContext context)
              def flowFile = session.get()
              if (!flowFile) return

              def breadcrumb = getBreadCrumb(context.procNode.processGroup) + '->' + context.getName()
              flowFile = session.putAttribute(flowFile, 'breadcrumb', breadcrumb)

              // transfer
              session.transfer(flowFile, this.REL_SUCCESS)


              // Recursive funtion that gets the breadcrumb
              String getBreadCrumb(processGroup)
              def breadCrumb = ''
              if(processGroup.parent != null)
              breadCrumb = getBreadCrumb(processGroup.parent) + '->'

              return breadCrumb + processGroup.name


              @Override
              void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
              def session = sessionFactory.createSession()
              try
              executeScript( session, context)
              session.commit()

              catch (final Throwable t)
              log.error(' failed to process due to ; rolling back session', [this, t] as Object[])
              session.rollback(true)
              throw t



              @Override
              PropertyDescriptor getPropertyDescriptor(String name) null

              @Override
              List<PropertyDescriptor> getPropertyDescriptors()
              return [] as List



              @Override
              void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)

              @Override
              Collection<ValidationResult> validate(ValidationContext context) null

              @Override
              String getIdentifier() null


              processor = new GroovyProcessor()





              share|improve this answer

























                1












                1








                1







                If you use a InvokeScriptedProcessor using groovy you can use



                context.procNode.processGroup


                from the ProcessContext
                If you want to extract all the parents in a breadcrum way, you can use this:



                import groovy.json.*;
                import org.apache.nifi.groups.*;

                class GroovyProcessor implements Processor

                def REL_SUCCESS = new Relationship.Builder()
                .name("success")
                .description('FlowFiles that were successfully processed are routed here').build()

                def ComponentLog log

                @Override
                void initialize(ProcessorInitializationContext context)
                log = context.logger


                @Override
                Set<Relationship> getRelationships()
                return [REL_SUCCESS] as Set


                void executeScript(ProcessSession session, ProcessContext context)
                def flowFile = session.get()
                if (!flowFile) return

                def breadcrumb = getBreadCrumb(context.procNode.processGroup) + '->' + context.getName()
                flowFile = session.putAttribute(flowFile, 'breadcrumb', breadcrumb)

                // transfer
                session.transfer(flowFile, this.REL_SUCCESS)


                // Recursive funtion that gets the breadcrumb
                String getBreadCrumb(processGroup)
                def breadCrumb = ''
                if(processGroup.parent != null)
                breadCrumb = getBreadCrumb(processGroup.parent) + '->'

                return breadCrumb + processGroup.name


                @Override
                void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
                def session = sessionFactory.createSession()
                try
                executeScript( session, context)
                session.commit()

                catch (final Throwable t)
                log.error(' failed to process due to ; rolling back session', [this, t] as Object[])
                session.rollback(true)
                throw t



                @Override
                PropertyDescriptor getPropertyDescriptor(String name) null

                @Override
                List<PropertyDescriptor> getPropertyDescriptors()
                return [] as List



                @Override
                void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)

                @Override
                Collection<ValidationResult> validate(ValidationContext context) null

                @Override
                String getIdentifier() null


                processor = new GroovyProcessor()





                share|improve this answer













                If you use a InvokeScriptedProcessor using groovy you can use



                context.procNode.processGroup


                from the ProcessContext
                If you want to extract all the parents in a breadcrum way, you can use this:



                import groovy.json.*;
                import org.apache.nifi.groups.*;

                class GroovyProcessor implements Processor

                def REL_SUCCESS = new Relationship.Builder()
                .name("success")
                .description('FlowFiles that were successfully processed are routed here').build()

                def ComponentLog log

                @Override
                void initialize(ProcessorInitializationContext context)
                log = context.logger


                @Override
                Set<Relationship> getRelationships()
                return [REL_SUCCESS] as Set


                void executeScript(ProcessSession session, ProcessContext context)
                def flowFile = session.get()
                if (!flowFile) return

                def breadcrumb = getBreadCrumb(context.procNode.processGroup) + '->' + context.getName()
                flowFile = session.putAttribute(flowFile, 'breadcrumb', breadcrumb)

                // transfer
                session.transfer(flowFile, this.REL_SUCCESS)


                // Recursive funtion that gets the breadcrumb
                String getBreadCrumb(processGroup)
                def breadCrumb = ''
                if(processGroup.parent != null)
                breadCrumb = getBreadCrumb(processGroup.parent) + '->'

                return breadCrumb + processGroup.name


                @Override
                void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException
                def session = sessionFactory.createSession()
                try
                executeScript( session, context)
                session.commit()

                catch (final Throwable t)
                log.error(' failed to process due to ; rolling back session', [this, t] as Object[])
                session.rollback(true)
                throw t



                @Override
                PropertyDescriptor getPropertyDescriptor(String name) null

                @Override
                List<PropertyDescriptor> getPropertyDescriptors()
                return [] as List



                @Override
                void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)

                @Override
                Collection<ValidationResult> validate(ValidationContext context) null

                @Override
                String getIdentifier() null


                processor = new GroovyProcessor()






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 at 8:04









                Óscar AndreuÓscar Andreu

                1,146728




                1,146728





























                    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%2f55288989%2fget-processgroup-from-processor%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현