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
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
add a comment |
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
add a comment |
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
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
java apache-camel
asked Mar 7 at 12:21
hochashochas
482417
482417
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
.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>
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
.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>
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
add a comment |
.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>
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
add a comment |
.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>
.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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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