How to get headers from one route to another route - Camel JavaDslCamel Route/ActiveMQ unmarshaling JSON and sending to methodsCamel Inter module coordination - dependencyCamel check header value after splitUnable to configure “Keep Alive” in Camel HTTP componentAccess enum.valueof() from apache camel routeRetrieve soap header from apache camel exchange objectApache Camel - Exchange body is null after upgrading spring boot versioncamel-http4 post not working I get no responseSpring Boot Camel Route - get data from rest endpointHow to trigger camel route from client request?
Pseudo Game of Cups in Python
Escape the labyrinth!
As a discovery writer, how do I complete an unfinished novel (which has highly diverged from the original plot ) after a time-gap?
Can multiple wall timers turn lights on or off when required?
How to make interviewee comfortable interviewing in lounge chairs
How do rulers get rich from war?
Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?
Safely hang a mirror that does not have hooks
Do things made of adamantine rust?
I reverse the source code, you negate the input!
How is the problem, G has no triangle in Logspace?
Circle divided by lines between a blue dots
Does a familiar stay the same after being true polymorphed and then dismissed and resummoned?
How to create a grid following points in QGIS?
Repeat elements in list, but the number of times each element is repeated is provided by a separate list
C# vector library
Where Does VDD+0.3V Input Limit Come From on IC chips?
Minimize taxes now that I earn more
Is Zack Morris's 'time stop' ability in "Saved By the Bell" a supernatural ability?
What was an "insurance cover"?
Should the pagination be reset when changing the order?
US entry with tourist visa but past alcohol arrest
Aligning two sets of equations with alignat?
CDG baggage claim before or after immigration?
How to get headers from one route to another route - Camel JavaDsl
Camel Route/ActiveMQ unmarshaling JSON and sending to methodsCamel Inter module coordination - dependencyCamel check header value after splitUnable to configure “Keep Alive” in Camel HTTP componentAccess enum.valueof() from apache camel routeRetrieve soap header from apache camel exchange objectApache Camel - Exchange body is null after upgrading spring boot versioncamel-http4 post not working I get no responseSpring Boot Camel Route - get data from rest endpointHow to trigger camel route from client request?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have camel rest endpoint with two params and when I send request it activates first route ("direct:amq"), where I get message from activeMq.
The headers here are okay, but this route activates another route ("direct:post)" and the headers there are missing.
I want to get the urlToPost Header from the first route in to the second.
rest("/getFromActiveMq").produces("application/json")
.get()
.param()
.name("urlToPost")
.type(RestParamType.query)
.dataType("String")
.endParam()
.param()
.name("getactivemq")
.type(RestParamType.query)
.dataType("String")
.endParam()
.to("direct:amq");
from("direct:amq").streamCaching()
.startupOrder(2)
.log("My activemq is " + "$in.header.getactivemq")
.log("My urlToPost is " + "$in.header.urlToPost")
.setHeader("myHeader")
.header("$in.header.urlToPost")
.log("My urlToPost Changed header is " + "$header.myHeader")
.process(exchange ->
String header = exchange.getIn().getHeader("urlToPost", String.class);
System.out.println(header);
exchange.getIn().setHeader("myShittyHeader", header);
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
.onCompletion()
.log("My body is : " + "$body")
.to("direct:post");
from("direct:post").tracing()
.process(exchange -> exchange.getIn()
.setBody(exchange.getIn()
.getBody()))
.convertBodyTo(String.class)
.process(exchange ->
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.log("My urlToPost BEFORE SETTING HEADERS is " + "$in.header.urlToPost")
.setHeader("Content-Type", constant("application/json"))
.setHeader("Accept", constant("application/json"))
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.log("My urlToPost AFTER SETTING HEADERS is " + "$in.header.urlToPost")
// .log("My HTTP_URI is: " + "$in.header.urlToPost")
// .to("http4://urlToPost")
// .to("direct:nothing");
.enrich()
.simple("http4://urlToPost");
I found that after:
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
Headers are gone
spring-boot apache-camel spring-camel
add a comment
|
I have camel rest endpoint with two params and when I send request it activates first route ("direct:amq"), where I get message from activeMq.
The headers here are okay, but this route activates another route ("direct:post)" and the headers there are missing.
I want to get the urlToPost Header from the first route in to the second.
rest("/getFromActiveMq").produces("application/json")
.get()
.param()
.name("urlToPost")
.type(RestParamType.query)
.dataType("String")
.endParam()
.param()
.name("getactivemq")
.type(RestParamType.query)
.dataType("String")
.endParam()
.to("direct:amq");
from("direct:amq").streamCaching()
.startupOrder(2)
.log("My activemq is " + "$in.header.getactivemq")
.log("My urlToPost is " + "$in.header.urlToPost")
.setHeader("myHeader")
.header("$in.header.urlToPost")
.log("My urlToPost Changed header is " + "$header.myHeader")
.process(exchange ->
String header = exchange.getIn().getHeader("urlToPost", String.class);
System.out.println(header);
exchange.getIn().setHeader("myShittyHeader", header);
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
.onCompletion()
.log("My body is : " + "$body")
.to("direct:post");
from("direct:post").tracing()
.process(exchange -> exchange.getIn()
.setBody(exchange.getIn()
.getBody()))
.convertBodyTo(String.class)
.process(exchange ->
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.log("My urlToPost BEFORE SETTING HEADERS is " + "$in.header.urlToPost")
.setHeader("Content-Type", constant("application/json"))
.setHeader("Accept", constant("application/json"))
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.log("My urlToPost AFTER SETTING HEADERS is " + "$in.header.urlToPost")
// .log("My HTTP_URI is: " + "$in.header.urlToPost")
// .to("http4://urlToPost")
// .to("direct:nothing");
.enrich()
.simple("http4://urlToPost");
I found that after:
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
Headers are gone
spring-boot apache-camel spring-camel
add a comment
|
I have camel rest endpoint with two params and when I send request it activates first route ("direct:amq"), where I get message from activeMq.
The headers here are okay, but this route activates another route ("direct:post)" and the headers there are missing.
I want to get the urlToPost Header from the first route in to the second.
rest("/getFromActiveMq").produces("application/json")
.get()
.param()
.name("urlToPost")
.type(RestParamType.query)
.dataType("String")
.endParam()
.param()
.name("getactivemq")
.type(RestParamType.query)
.dataType("String")
.endParam()
.to("direct:amq");
from("direct:amq").streamCaching()
.startupOrder(2)
.log("My activemq is " + "$in.header.getactivemq")
.log("My urlToPost is " + "$in.header.urlToPost")
.setHeader("myHeader")
.header("$in.header.urlToPost")
.log("My urlToPost Changed header is " + "$header.myHeader")
.process(exchange ->
String header = exchange.getIn().getHeader("urlToPost", String.class);
System.out.println(header);
exchange.getIn().setHeader("myShittyHeader", header);
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
.onCompletion()
.log("My body is : " + "$body")
.to("direct:post");
from("direct:post").tracing()
.process(exchange -> exchange.getIn()
.setBody(exchange.getIn()
.getBody()))
.convertBodyTo(String.class)
.process(exchange ->
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.log("My urlToPost BEFORE SETTING HEADERS is " + "$in.header.urlToPost")
.setHeader("Content-Type", constant("application/json"))
.setHeader("Accept", constant("application/json"))
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.log("My urlToPost AFTER SETTING HEADERS is " + "$in.header.urlToPost")
// .log("My HTTP_URI is: " + "$in.header.urlToPost")
// .to("http4://urlToPost")
// .to("direct:nothing");
.enrich()
.simple("http4://urlToPost");
I found that after:
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
Headers are gone
spring-boot apache-camel spring-camel
I have camel rest endpoint with two params and when I send request it activates first route ("direct:amq"), where I get message from activeMq.
The headers here are okay, but this route activates another route ("direct:post)" and the headers there are missing.
I want to get the urlToPost Header from the first route in to the second.
rest("/getFromActiveMq").produces("application/json")
.get()
.param()
.name("urlToPost")
.type(RestParamType.query)
.dataType("String")
.endParam()
.param()
.name("getactivemq")
.type(RestParamType.query)
.dataType("String")
.endParam()
.to("direct:amq");
from("direct:amq").streamCaching()
.startupOrder(2)
.log("My activemq is " + "$in.header.getactivemq")
.log("My urlToPost is " + "$in.header.urlToPost")
.setHeader("myHeader")
.header("$in.header.urlToPost")
.log("My urlToPost Changed header is " + "$header.myHeader")
.process(exchange ->
String header = exchange.getIn().getHeader("urlToPost", String.class);
System.out.println(header);
exchange.getIn().setHeader("myShittyHeader", header);
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
.onCompletion()
.log("My body is : " + "$body")
.to("direct:post");
from("direct:post").tracing()
.process(exchange -> exchange.getIn()
.setBody(exchange.getIn()
.getBody()))
.convertBodyTo(String.class)
.process(exchange ->
Map<String, Object> hdr = exchange.getIn()
.getHeaders();
for (Map.Entry<String, Object> entry : hdr.entrySet())
System.out.println(entry.getKey() + "/" + entry.getValue());
)
.log("My urlToPost BEFORE SETTING HEADERS is " + "$in.header.urlToPost")
.setHeader("Content-Type", constant("application/json"))
.setHeader("Accept", constant("application/json"))
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.log("My urlToPost AFTER SETTING HEADERS is " + "$in.header.urlToPost")
// .log("My HTTP_URI is: " + "$in.header.urlToPost")
// .to("http4://urlToPost")
// .to("direct:nothing");
.enrich()
.simple("http4://urlToPost");
I found that after:
.pollEnrich()
.simple("activemq://$in.header.getactivemq")
Headers are gone
spring-boot apache-camel spring-camel
spring-boot apache-camel spring-camel
edited Mar 28 at 15:20
xmlParser
asked Mar 28 at 13:09
xmlParserxmlParser
7451 gold badge6 silver badges23 bronze badges
7451 gold badge6 silver badges23 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
The pollEnrich merges your current Exchange with another message. That means it is in effect an Aggregator.
If you don't provide an aggregation strategy, Camel uses by default a simple body aggregation. This is the reason why you lose your headers.
You have to configure a pre-existing or implement your own aggregation strategy that respects the headers of one or both messages during aggregation.
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/4.0/"u003ecc by-sa 4.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%2f55398467%2fhow-to-get-headers-from-one-route-to-another-route-camel-javadsl%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
The pollEnrich merges your current Exchange with another message. That means it is in effect an Aggregator.
If you don't provide an aggregation strategy, Camel uses by default a simple body aggregation. This is the reason why you lose your headers.
You have to configure a pre-existing or implement your own aggregation strategy that respects the headers of one or both messages during aggregation.
add a comment
|
The pollEnrich merges your current Exchange with another message. That means it is in effect an Aggregator.
If you don't provide an aggregation strategy, Camel uses by default a simple body aggregation. This is the reason why you lose your headers.
You have to configure a pre-existing or implement your own aggregation strategy that respects the headers of one or both messages during aggregation.
add a comment
|
The pollEnrich merges your current Exchange with another message. That means it is in effect an Aggregator.
If you don't provide an aggregation strategy, Camel uses by default a simple body aggregation. This is the reason why you lose your headers.
You have to configure a pre-existing or implement your own aggregation strategy that respects the headers of one or both messages during aggregation.
The pollEnrich merges your current Exchange with another message. That means it is in effect an Aggregator.
If you don't provide an aggregation strategy, Camel uses by default a simple body aggregation. This is the reason why you lose your headers.
You have to configure a pre-existing or implement your own aggregation strategy that respects the headers of one or both messages during aggregation.
answered Mar 28 at 16:14
burkiburki
2,7021 gold badge6 silver badges20 bronze badges
2,7021 gold badge6 silver badges20 bronze badges
add a comment
|
add a comment
|
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.
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%2f55398467%2fhow-to-get-headers-from-one-route-to-another-route-camel-javadsl%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