Apache camel: data from exchange header to another route
<p>I have to ask about camel route behaviour, which is silly (but simple to understand) logical description.
In main themes - i need to push info from exchange header of one route to another one.
It's all about CMDB system and monitoring tool zabbix.
Well, at the first i have a route which can switch CI state in CMDB:</p>

<pre><code>&lt;route&gt;
    &lt;description&gt; route catching CI ID in jms queue, check it on exist and switch CI state to incident
    &lt;/description&gt;
    &lt;from uri="jms:switchCIStateQueue"/&gt;
    &lt;filter&gt;
        &lt;simple&gt;${body} regex '[\d]+'&lt;/simple&gt;
        &lt;to uri="bean:otrsCIApi?method=getCIBodyByID(${body})"/&gt;
        &lt;filter&gt;
            &lt;simple&gt;${body} regex '\{.+?\}'&lt;/simple&gt;
            &lt;marshal&gt;
                &lt;json library="Jackson"/&gt;
            &lt;/marshal&gt;
            &lt;unmarshal&gt;
                &lt;json library="Jackson" unmarshalTypeName="ts.team.otrs.ci.OtrsCI"/&gt;
            &lt;/unmarshal&gt;
            &lt;to uri="bean:otrsCIApi?method=switchOTRSCIState(${body})"/&gt;
        &lt;/filter&gt;
    &lt;/filter&gt;
&lt;/route&gt;
</code></pre>

<p>It's working good, but i have to use this action from another route, which have many checks, filters and choices.
My problem is that i don't have a CI ID as a body (but keep it in header) in depth of main logical route.</p>

<pre><code>&lt;route&gt;
    &lt;description&gt;Route catch triggerid 
     and creates a ticket in OTRS, link it to host
    &lt;/description&gt;
    &lt;from uri="direct:zab_trig_2_otrs_tick"/&gt;
    &lt;to uri="bean:zabbixApi?method=getTriggerByID(body)"/&gt;
    &lt;filter&gt;
        &lt;simple&gt;${body} regex '\{.+?\}'&lt;/simple&gt;
            &lt;marshal&gt;
                &lt;json library="Jackson"/&gt;
            &lt;/marshal&gt; 
            &lt;unmarshal&gt;
                 &lt;json library="Jackson" unmarshalTypeName="ts.team.zabbix.trigger.SingleTrigger"/&gt;
            &lt;/unmarshal&gt;
            &lt;setHeader headerName="ZabbixTrigger" id="_setZabbixTrigger"&gt;
                &lt;simple&gt;${body}&lt;/simple&gt;
            &lt;/setHeader&gt;
            &lt;!-- search CI in OTRS --&gt;
            &lt;to uri="bean:otrsCIApi?method=searchCI(${body.getHosts().get(0).getName()})"/&gt;
            &lt;!-- Array of CI ID like [] or ["1"] --&gt;
            &lt;split streaming="true"&gt;
                &lt;simple&gt;${body}&lt;/simple&gt;
                &lt;!-- place it in header--&gt;
                &lt;setHeader headerName="HostID"&gt;
                    &lt;simple&gt;${body}&lt;/simple&gt;
                &lt;/setHeader&gt;
                &lt;to uri="bean:otrsLinkApi?method=ListLinkedTicketsTitleFiltered(${body},${header.ZabbixTrigger.getDescription()})"/&gt;
                &lt;!-- return JSONArray  with State=open otrs Tickets ID --&gt;
                &lt;choice&gt;
                    &lt;when id="ticketslist_empty"&gt;
                        &lt;simple&gt;${body} == ''&lt;/simple&gt;
                        &lt;!-- Create ticket, connect it to host in OTRS --&gt;
                        &lt;to uri="bean:otrsTicketApi?method=createNewTicket(${header.ZabbixTrigger.getDescription()},${header.ZabbixTrigger.getPriority()})"/&gt;
                        &lt;!-- return body body with ticket id, create link with  ${header.HostID} --&gt;
                        &lt;to uri="bean:otrsLinkApi?method=LinkAdd(${header.HostID},${body})"/&gt;
                        &lt;!-- Here i need to switch CI state if incident priority is higher than 3(Normal)--&gt;
                        &lt;when&gt;
                            &lt;simple&gt;${header.ZabbixTrigger.getPriority()} &gt; 3&lt;/simple&gt;
                            &lt;!-- here i need to send  ${header.HostID} to previous described route (jms:switchCIStateQueue)--&gt;
                        &lt;/when&gt;
                    &lt;/when&gt;
                &lt;/choice&gt;
            &lt;/split&gt;
    &lt;/filter&gt;
&lt;/route&gt;
</code></pre>

<p>So, there is piece of this route:</p>

<pre><code>                    &lt;when&gt;
                        &lt;simple&gt;${header.ZabbixTrigger.getPriority()} &gt; 3&lt;/simple&gt;
                        &lt;!-- here i need to send  ${header.HostID} to previous described route (jms:switchCIStateQueue)--&gt;
                    &lt;/when&gt;
</code></pre>

<p>where i need to send some info from my header to jms:switchCIStateQueue (or route direct, it's no matter where to).
I hope, my description of problem is quite full and simple.</p>