[
https://issues.apache.org/jira/browse/CAMEL-3857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-3857:
-------------------------------
Description:
If you use wiretap to send a new message to an endpoint, then you can only
provide headers if you use a Processor. However what people would like to do is
to provide headers in the DSL. Usually from XML DSL.
So what you can do now in Java DSL
{code}
.wireTap("direct:tap")
// create the new tap message body and headers
.newExchangeBody(constant("Bye World"))
.newExchangeHeader("id", constant(123))
.newExchangeHeader("date",
simple("${date:now:yyyyMMdd}"))
.end()
{code}
And in XML DSL (has a slight different names for body/header), to reuse the
existing <setHeader> element
{code:xml}
<wireTap uri="direct:tap">
<!-- create the new tap message body and headers -->
<body><constant>Bye World</constant></body>
<setHeader headerName="id"><constant>123</constant></setHeader>
<setHeader
headerName="date"><simple>${date:now:yyyyMMdd}</simple></setHeader>
</wireTap>
{code}
was:
If you use wiretap to send a new message to an endpoint, then you can only
provide headers if you use a Processor. However what people would like to do is
to provide headers in the DSL. Usually from XML DSL.
So what you can do now in Java DSL
{code:
.wireTap("direct:tap")
// create the new tap message body and headers
.newExchangeBody(constant("Bye World"))
.newExchangeHeader("id", constant(123))
.newExchangeHeader("date",
simple("${date:now:yyyyMMdd}"))
.end()
{code}
And in XML DSL (has a slight different names for body/header), to reuse the
existing <setHeader> element
{code:xml}
<wireTap uri="direct:tap">
<!-- create the new tap message body and headers -->
<body><constant>Bye World</constant></body>
<setHeader headerName="id"><constant>123</constant></setHeader>
<setHeader
headerName="date"><simple>${date:now:yyyyMMdd}</simple></setHeader>
</wireTap>
{code}
> WireTap EIP - new message mode - Allow to set headers
> -----------------------------------------------------
>
> Key: CAMEL-3857
> URL: https://issues.apache.org/jira/browse/CAMEL-3857
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.8.0
>
>
> If you use wiretap to send a new message to an endpoint, then you can only
> provide headers if you use a Processor. However what people would like to do
> is to provide headers in the DSL. Usually from XML DSL.
> So what you can do now in Java DSL
> {code}
> .wireTap("direct:tap")
> // create the new tap message body and headers
> .newExchangeBody(constant("Bye World"))
> .newExchangeHeader("id", constant(123))
> .newExchangeHeader("date",
> simple("${date:now:yyyyMMdd}"))
> .end()
> {code}
> And in XML DSL (has a slight different names for body/header), to reuse the
> existing <setHeader> element
> {code:xml}
> <wireTap uri="direct:tap">
> <!-- create the new tap message body and headers -->
> <body><constant>Bye World</constant></body>
> <setHeader
> headerName="id"><constant>123</constant></setHeader>
> <setHeader
> headerName="date"><simple>${date:now:yyyyMMdd}</simple></setHeader>
> </wireTap>
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira