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

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme