Camel recipientList not iterating all recipients2019 Community Moderator ElectionHow do I efficiently iterate over each entry in a Java Map?Including all the jars in a directory within the Java classpathIterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loopIterate through a HashMapA 'for' loop to iterate over an enum in JavaWhat exactly is Apache Camel?Using smtp with recipientList in CamelCamel how to update multiple tablesApache Camel routing with recipientListBuilding Apache Camel Routes Dynamically

Unreachable code, but reachable with exception

2D counterpart of std::array in C++17

PTIJ: Who should pay for Uber rides: the child or the parent?

Instead of Universal Basic Income, why not Universal Basic NEEDS?

Informing my boss about remarks from a nasty colleague

Make a transparent 448*448 image

Can elves maintain concentration in a trance?

Russian cases: A few examples, I'm really confused

Define, (actually define) the "stability" and "energy" of a compound

Brexit - No Deal Rejection

Rules about breaking the rules. How do I do it well?

Dot in front of file

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

When do we add an hyphen (-) to a complex adjective word?

Current sense amp + op-amp buffer + ADC: Measuring down to 0 with single supply

Will a pinhole camera work with instant film?

Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab

The use of "touch" and "touch on" in context

Have researchers managed to "reverse time"? If so, what does that mean for physics?

What is this large pipe coming out of my roof?

What has been your most complicated TikZ drawing?

It's a yearly task, alright

Be in awe of my brilliance!

Can hydraulic brake levers get hot when brakes overheat?



Camel recipientList not iterating all recipients



2019 Community Moderator ElectionHow do I efficiently iterate over each entry in a Java Map?Including all the jars in a directory within the Java classpathIterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loopIterate through a HashMapA 'for' loop to iterate over an enum in JavaWhat exactly is Apache Camel?Using smtp with recipientList in CamelCamel how to update multiple tablesApache Camel routing with recipientListBuilding Apache Camel Routes Dynamically










1















I am writing a Camel integration that can consume an arbitrary number of queries and execute those against an arbitrary number of databases.



The route starts by getting all queries located in a folder and then uses a splitter to iterate over them in order:



from("quartz2:quartzInitializer?cron=sync.cron")
.routeId("quartzInitializer")
.bean(QueryHandler.class, "getQueries")
.split(exchangeProperty(QueryHandler.Properties.QUERIES))
.setProperty(Properties.CURRENT_QUERY, simple("body"))
.to("direct:executeSingleQuery")
.end();


In the above snippet, the property QueryHandler.Properties.QUERIES contains two query file locations:



config/sql/1__select_stat_machine.sql
config/sql/2__select_stat_session.sql


Next, I send the location of the iterated query and construct a recipient list from it:



from("direct:executeSingleQuery")
.routeId("executeSingleQuery")
.bean(DataSourceHandler.class, "createEndpointsWithQuery")
.recipientList(exchangeProperty(DataSourceHandler.Properties.QUERY_RECIPIENTS))
.parallelProcessing()
.log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


In the above snippet, the parameter DataSourceHandler.Properties.QUERY_RECIPIENTS contains two recipients:



sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource3&outputHeader=resultset
sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset


However, when I run this, only one of the recipients are called, in this case only datasource2, which was at index 1 in the list passed to the recipientList:



Calling sql://file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset
Calling sql://file:config/sql/2__select_stat_session.sql?dataSource=datasource2&outputHeader=resultset


I can't for the life of me figure out what I'm doing wrong. Am I missing an end() somewhere? Is my splitter at fault, or is it my recipient list?










share|improve this question


























    1















    I am writing a Camel integration that can consume an arbitrary number of queries and execute those against an arbitrary number of databases.



    The route starts by getting all queries located in a folder and then uses a splitter to iterate over them in order:



    from("quartz2:quartzInitializer?cron=sync.cron")
    .routeId("quartzInitializer")
    .bean(QueryHandler.class, "getQueries")
    .split(exchangeProperty(QueryHandler.Properties.QUERIES))
    .setProperty(Properties.CURRENT_QUERY, simple("body"))
    .to("direct:executeSingleQuery")
    .end();


    In the above snippet, the property QueryHandler.Properties.QUERIES contains two query file locations:



    config/sql/1__select_stat_machine.sql
    config/sql/2__select_stat_session.sql


    Next, I send the location of the iterated query and construct a recipient list from it:



    from("direct:executeSingleQuery")
    .routeId("executeSingleQuery")
    .bean(DataSourceHandler.class, "createEndpointsWithQuery")
    .recipientList(exchangeProperty(DataSourceHandler.Properties.QUERY_RECIPIENTS))
    .parallelProcessing()
    .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


    In the above snippet, the parameter DataSourceHandler.Properties.QUERY_RECIPIENTS contains two recipients:



    sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource3&outputHeader=resultset
    sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset


    However, when I run this, only one of the recipients are called, in this case only datasource2, which was at index 1 in the list passed to the recipientList:



    Calling sql://file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset
    Calling sql://file:config/sql/2__select_stat_session.sql?dataSource=datasource2&outputHeader=resultset


    I can't for the life of me figure out what I'm doing wrong. Am I missing an end() somewhere? Is my splitter at fault, or is it my recipient list?










    share|improve this question
























      1












      1








      1








      I am writing a Camel integration that can consume an arbitrary number of queries and execute those against an arbitrary number of databases.



      The route starts by getting all queries located in a folder and then uses a splitter to iterate over them in order:



      from("quartz2:quartzInitializer?cron=sync.cron")
      .routeId("quartzInitializer")
      .bean(QueryHandler.class, "getQueries")
      .split(exchangeProperty(QueryHandler.Properties.QUERIES))
      .setProperty(Properties.CURRENT_QUERY, simple("body"))
      .to("direct:executeSingleQuery")
      .end();


      In the above snippet, the property QueryHandler.Properties.QUERIES contains two query file locations:



      config/sql/1__select_stat_machine.sql
      config/sql/2__select_stat_session.sql


      Next, I send the location of the iterated query and construct a recipient list from it:



      from("direct:executeSingleQuery")
      .routeId("executeSingleQuery")
      .bean(DataSourceHandler.class, "createEndpointsWithQuery")
      .recipientList(exchangeProperty(DataSourceHandler.Properties.QUERY_RECIPIENTS))
      .parallelProcessing()
      .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


      In the above snippet, the parameter DataSourceHandler.Properties.QUERY_RECIPIENTS contains two recipients:



      sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource3&outputHeader=resultset
      sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset


      However, when I run this, only one of the recipients are called, in this case only datasource2, which was at index 1 in the list passed to the recipientList:



      Calling sql://file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset
      Calling sql://file:config/sql/2__select_stat_session.sql?dataSource=datasource2&outputHeader=resultset


      I can't for the life of me figure out what I'm doing wrong. Am I missing an end() somewhere? Is my splitter at fault, or is it my recipient list?










      share|improve this question














      I am writing a Camel integration that can consume an arbitrary number of queries and execute those against an arbitrary number of databases.



      The route starts by getting all queries located in a folder and then uses a splitter to iterate over them in order:



      from("quartz2:quartzInitializer?cron=sync.cron")
      .routeId("quartzInitializer")
      .bean(QueryHandler.class, "getQueries")
      .split(exchangeProperty(QueryHandler.Properties.QUERIES))
      .setProperty(Properties.CURRENT_QUERY, simple("body"))
      .to("direct:executeSingleQuery")
      .end();


      In the above snippet, the property QueryHandler.Properties.QUERIES contains two query file locations:



      config/sql/1__select_stat_machine.sql
      config/sql/2__select_stat_session.sql


      Next, I send the location of the iterated query and construct a recipient list from it:



      from("direct:executeSingleQuery")
      .routeId("executeSingleQuery")
      .bean(DataSourceHandler.class, "createEndpointsWithQuery")
      .recipientList(exchangeProperty(DataSourceHandler.Properties.QUERY_RECIPIENTS))
      .parallelProcessing()
      .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


      In the above snippet, the parameter DataSourceHandler.Properties.QUERY_RECIPIENTS contains two recipients:



      sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource3&outputHeader=resultset
      sql:file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset


      However, when I run this, only one of the recipients are called, in this case only datasource2, which was at index 1 in the list passed to the recipientList:



      Calling sql://file:config/sql/1__select_stat_machine.sql?dataSource=datasource2&outputHeader=resultset
      Calling sql://file:config/sql/2__select_stat_session.sql?dataSource=datasource2&outputHeader=resultset


      I can't for the life of me figure out what I'm doing wrong. Am I missing an end() somewhere? Is my splitter at fault, or is it my recipient list?







      java apache-camel






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 12:21









      hochashochas

      482417




      482417






















          1 Answer
          1






          active

          oldest

          votes


















          2














          .recipientList(exchangeProperty(...))
          .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


          Your are putting the log statement in the wrong place.
          Basically the way you have modelled your route is:
          "Please send the messages to all recipients, and AFTER this, print a message". The fact is that after looping through the list of recipients, Camel variable holds the URI of the LAST recipient.



          It is more obvious in Spring DSL:



          What your Camel route is doing:



          <recipientList>
          <header>...</header>
          </recipientList>
          <log message="Done"/>


          versus what you think Camel is doing:



          <recipientList>
          <header>...</header>
          <log message="Done"/>
          </recipientList>





          share|improve this answer























          • This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

            – hochas
            Mar 9 at 10:29










          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%2f55043676%2fcamel-recipientlist-not-iterating-all-recipients%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














          .recipientList(exchangeProperty(...))
          .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


          Your are putting the log statement in the wrong place.
          Basically the way you have modelled your route is:
          "Please send the messages to all recipients, and AFTER this, print a message". The fact is that after looping through the list of recipients, Camel variable holds the URI of the LAST recipient.



          It is more obvious in Spring DSL:



          What your Camel route is doing:



          <recipientList>
          <header>...</header>
          </recipientList>
          <log message="Done"/>


          versus what you think Camel is doing:



          <recipientList>
          <header>...</header>
          <log message="Done"/>
          </recipientList>





          share|improve this answer























          • This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

            – hochas
            Mar 9 at 10:29















          2














          .recipientList(exchangeProperty(...))
          .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


          Your are putting the log statement in the wrong place.
          Basically the way you have modelled your route is:
          "Please send the messages to all recipients, and AFTER this, print a message". The fact is that after looping through the list of recipients, Camel variable holds the URI of the LAST recipient.



          It is more obvious in Spring DSL:



          What your Camel route is doing:



          <recipientList>
          <header>...</header>
          </recipientList>
          <log message="Done"/>


          versus what you think Camel is doing:



          <recipientList>
          <header>...</header>
          <log message="Done"/>
          </recipientList>





          share|improve this answer























          • This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

            – hochas
            Mar 9 at 10:29













          2












          2








          2







          .recipientList(exchangeProperty(...))
          .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


          Your are putting the log statement in the wrong place.
          Basically the way you have modelled your route is:
          "Please send the messages to all recipients, and AFTER this, print a message". The fact is that after looping through the list of recipients, Camel variable holds the URI of the LAST recipient.



          It is more obvious in Spring DSL:



          What your Camel route is doing:



          <recipientList>
          <header>...</header>
          </recipientList>
          <log message="Done"/>


          versus what you think Camel is doing:



          <recipientList>
          <header>...</header>
          <log message="Done"/>
          </recipientList>





          share|improve this answer













          .recipientList(exchangeProperty(...))
          .log(LoggingLevel.INFO, String.format("Calling $in.header.%s", Exchange.RECIPIENT_LIST_ENDPOINT));


          Your are putting the log statement in the wrong place.
          Basically the way you have modelled your route is:
          "Please send the messages to all recipients, and AFTER this, print a message". The fact is that after looping through the list of recipients, Camel variable holds the URI of the LAST recipient.



          It is more obvious in Spring DSL:



          What your Camel route is doing:



          <recipientList>
          <header>...</header>
          </recipientList>
          <log message="Done"/>


          versus what you think Camel is doing:



          <recipientList>
          <header>...</header>
          <log message="Done"/>
          </recipientList>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 10:12









          TacheDeChocoTacheDeChoco

          1,330810




          1,330810












          • This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

            – hochas
            Mar 9 at 10:29

















          • This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

            – hochas
            Mar 9 at 10:29
















          This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

          – hochas
          Mar 9 at 10:29





          This makes a lot of sense, I will test this when I'm back at work. In the mean time, thanks a lot!

          – hochas
          Mar 9 at 10:29



















          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%2f55043676%2fcamel-recipientlist-not-iterating-all-recipients%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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page