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;








2















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










share|improve this question
































    2















    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










    share|improve this question




























      2












      2








      2








      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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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

























          1 Answer
          1






          active

          oldest

          votes


















          1
















          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.






          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/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
            );



            );














            draft saved

            draft discarded
















            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









            1
















            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.






            share|improve this answer





























              1
















              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.






              share|improve this answer



























                1














                1










                1









                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 16:14









                burkiburki

                2,7021 gold badge6 silver badges20 bronze badges




                2,7021 gold badge6 silver badges20 bronze badges



















                    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.




















                    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%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





















































                    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권, 지리지 충청도 공주목 은진현