[ 
https://issues.apache.org/jira/browse/CAMEL-17649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17492510#comment-17492510
 ] 

Aurélien Pupier edited comment on CAMEL-17649 at 2/15/22, 10:27 AM:
--------------------------------------------------------------------

it seems that in fact, usage of headerName or name attributes depends on more 
parameters:

using route attribute directly, when loading, iI need to use the name:

{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<route id="a-route-id">
    <from uri="direct:testSetBreakpoint" />
    <setHeader name="header1">
        <constant>value of header 1</constant>
    </setHeader>
    <setHeader name="header2">
        <constant>value of header 2</constant>
    </setHeader>
    <setProperty name="property1">
        <constant>value of property 1</constant>
    </setProperty>
    <setProperty name="property2">
        <constant>value of property 2</constant>
    </setProperty>
    <log message="Log From Test" id="testBasicFlow-log-id" /> <!-- 
XXX-breakpoint-XXX -->
</route>
{noformat}

when using the spring and camelcontext, I need to use the headerName:

{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="
          http://www.springframework.org/schema/beans 
https://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://camel.apache.org/schema/spring 
https://camel.apache.org/schema/spring/camel-spring.xsd";>
    <camelContext
        xmlns="http://camel.apache.org/schema/spring";>
        <route id="a-route-id">
            <from uri="direct:testSetBreakpoint" />
            <setHeader headerName="header1">
                <constant>value of header 1</constant>
            </setHeader>
            <setHeader headerName="header2">
                <constant>value of header 2</constant>
            </setHeader>
            <setProperty propertyName="property1">
                <constant>value of property 1</constant>
            </setProperty>
            <setProperty propertyName="property2">
                <constant>value of property 2</constant>
            </setProperty>
            <log message="Log From Test" id="testBasicFlow-log-id" /> <!-- 
XXX-breakpoint-XXX -->
        </route>
    </camelContext>
</beans>
{noformat}


was (Author: apupier):
it seems that in fact, usage of headerName or name attributes depends on more 
parameters:

using route attribute directly, when loading, iI need to use the name:
{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<route id="a-route-id">
    <from uri="direct:testSetBreakpoint" />
    <setHeader name="header1">
        <constant>value of header 1</constant>
    </setHeader>
    <setHeader name="header2">
        <constant>value of header 2</constant>
    </setHeader>
    <setProperty name="property1">
        <constant>value of property 1</constant>
    </setProperty>
    <setProperty name="property2">
        <constant>value of property 2</constant>
    </setProperty>
    <log message="Log From Test" id="testBasicFlow-log-id" /> <!-- 
XXX-breakpoint-XXX -->
</route>
{noformat}

when using the spring and camelcontext, I need to use the headerName:

{noformaŧ}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="
          http://www.springframework.org/schema/beans 
https://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://camel.apache.org/schema/spring 
https://camel.apache.org/schema/spring/camel-spring.xsd";>
    <camelContext
        xmlns="http://camel.apache.org/schema/spring";>
        <route id="a-route-id">
            <from uri="direct:testSetBreakpoint" />
            <setHeader headerName="header1">
                <constant>value of header 1</constant>
            </setHeader>
            <setHeader headerName="header2">
                <constant>value of header 2</constant>
            </setHeader>
            <setProperty propertyName="property1">
                <constant>value of property 1</constant>
            </setProperty>
            <setProperty propertyName="property2">
                <constant>value of property 2</constant>
            </setProperty>
            <log message="Log From Test" id="testBasicFlow-log-id" /> <!-- 
XXX-breakpoint-XXX -->
        </route>
    </camelContext>
</beans>
{noformat}

> Examples for setHeader in example are outdated: it contains name attribute 
> instead of headerName
> ------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17649
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17649
>             Project: Camel
>          Issue Type: Bug
>          Components: documentation, eip
>    Affects Versions: 3.15.0
>            Reporter: Aurélien Pupier
>            Priority: Major
>
> see 
> https://camel.apache.org/components/3.15.x/eips/setHeader-eip.html#_using_set_header
> {noformat}
> <route>
>     <from uri="direct:a"/>
>     <setHeader name="myHeader">
>         <constant>test</constant>
>     </setHeader>
>     <to uri="direct:b"/>
> </route>
> {noformat}
> I think that it should be:
> {noformat}
> <route>
>     <from uri="direct:a"/>
>     <setHeader headerName="myHeader">
>         <constant>test</constant>
>     </setHeader>
>     <to uri="direct:b"/>
> </route>
> {noformat}
> it was renamed with 3.0 
> https://camel.apache.org/manual/camel-3-migration-guide.html#_setheader_and_setproperty_in_xml_dsl



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to