You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "jan.schjoenning" <ja...@gmail.com> on 2017/04/27 06:26:26 UTC
header message show different values in log statements
Given following route :
from("direct:TranslateEpgData")
.routeId("TranslateEpgData")
.setHeader("xxx", constant("xxx"))
.to("log:?showAll=true&multiline=true")
.log("serviceId = ${header.serviceId}, scheduleStart =
${header.scheduleStart}, scheduleEnd = ${header.scheduleEnd}, originId =
${header.originId}")
.to("log:?showAll=true&multiline=true")
.to("xslt:whatson_to_tvanytime.xsl")
.log("${body}");
1. log of ${header.serviceId} =
serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6
2. log of ${header.serviceId} = TV2ZULU
3. log of ${header.serviceId} =
serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6
As flow states no changes between , why do i have this difference ?
actual Output:
[main] INFO - Exchange[
, Id: ID-mac161892-local-54873-1493272656658-1-6
, ExchangePattern: InOnly
, Properties: {CamelAggregationStrategy={Splitter[on: XPath:
//tva:ServiceInformation to:
Channel[Multicast[[Channel[sendTo(Endpoint[direct://step2])]]]] aggregate:
null]=UseOriginalAggregationStrategy}, CamelBatchComplete=true,
CamelBatchIndex=0, CamelBatchSize=1,
CamelCorrelationId=ID-mac161892-local-54873-1493272656658-1-4,
CamelCreatedTimestamp=Thu Apr 27 07:57:37 CEST 2017,
CamelFileExchangeFile=RemoteFile[TV2ZULU.xml],
CamelMessageHistory=[DefaultMessageHistory[routeId=MEnrichWithTV2Channels,
node=multicast1], DefaultMessageHistory[routeId=MEnrichWithTV2Channels,
node=to6], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=setHeader9], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=setHeader10], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=log11], DefaultMessageHistory[routeId=MEnrichWithEpgData, node=log12],
DefaultMessageHistory[routeId=MEnrichWithEpgData, node=to7],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log1],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log2],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=pollEnrich1],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log3],
DefaultMessageHistory[routeId=MEnrichWithEpgData, node=to8],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log13],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log14],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log15],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log16],
DefaultMessageHistory[routeId=MTranslateEpgData, node=to9],
DefaultMessageHistory[routeId=TranslateEpgData, node=setHeader1],
DefaultMessageHistory[routeId=TranslateEpgData, node=to1]],
CamelMulticastComplete=true, CamelMulticastIndex=0, CamelSplitComplete=true,
CamelSplitIndex=0, CamelSplitSize=1,
CamelStreamCacheUnitOfWork=DefaultUnitOfWork,
CamelToEndpoint=log://?multiline=true&showAll=true}
, Headers: {breadcrumbId=ID-mac161892-local-54873-1493272656658-1-1,
channelId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@483f6d77,
originId=Whatson, scheduleDate=2017-04-27, scheduleEnd=2017-04-28 06:00:00,
scheduleStart=2017-04-27 06:00:00,
serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6,
xxx=xxx}
, BodyType: org.apache.camel.component.file.remote.RemoteFile
, Body: [Body is file based: RemoteFile[TV2ZULU.xml]]
, Out: null:
]
[main] INFO TranslateEpgData - serviceId = TV2ZULU, scheduleStart =
2017-04-27 06:00:00, scheduleEnd = 2017-04-28 06:00:00, originId = Whatson
[main] INFO - Exchange[
, Id: ID-mac161892-local-54873-1493272656658-1-6
, ExchangePattern: InOnly
, Properties: {CamelAggregationStrategy={Splitter[on: XPath:
//tva:ServiceInformation to:
Channel[Multicast[[Channel[sendTo(Endpoint[direct://step2])]]]] aggregate:
null]=UseOriginalAggregationStrategy}, CamelBatchComplete=true,
CamelBatchIndex=0, CamelBatchSize=1,
CamelCorrelationId=ID-mac161892-local-54873-1493272656658-1-4,
CamelCreatedTimestamp=Thu Apr 27 07:57:37 CEST 2017,
CamelFileExchangeFile=RemoteFile[TV2ZULU.xml],
CamelMessageHistory=[DefaultMessageHistory[routeId=MEnrichWithTV2Channels,
node=multicast1], DefaultMessageHistory[routeId=MEnrichWithTV2Channels,
node=to6], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=setHeader9], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=setHeader10], DefaultMessageHistory[routeId=MEnrichWithEpgData,
node=log11], DefaultMessageHistory[routeId=MEnrichWithEpgData, node=log12],
DefaultMessageHistory[routeId=MEnrichWithEpgData, node=to7],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log1],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log2],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=pollEnrich1],
DefaultMessageHistory[routeId=EnrichWithEpgData, node=log3],
DefaultMessageHistory[routeId=MEnrichWithEpgData, node=to8],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log13],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log14],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log15],
DefaultMessageHistory[routeId=MTranslateEpgData, node=log16],
DefaultMessageHistory[routeId=MTranslateEpgData, node=to9],
DefaultMessageHistory[routeId=TranslateEpgData, node=setHeader1],
DefaultMessageHistory[routeId=TranslateEpgData, node=to1],
DefaultMessageHistory[routeId=TranslateEpgData, node=log4],
DefaultMessageHistory[routeId=TranslateEpgData, node=to2]],
CamelMulticastComplete=true, CamelMulticastIndex=0, CamelSplitComplete=true,
CamelSplitIndex=0, CamelSplitSize=1,
CamelStreamCacheUnitOfWork=DefaultUnitOfWork,
CamelToEndpoint=log://?multiline=true&showAll=true}
, Headers: {breadcrumbId=ID-mac161892-local-54873-1493272656658-1-1,
channelId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@483f6d77,
originId=Whatson, scheduleDate=2017-04-27, scheduleEnd=2017-04-28 06:00:00,
scheduleStart=2017-04-27 06:00:00,
serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6,
xxx=xxx}
, BodyType: org.apache.camel.component.file.remote.RemoteFile
, Body: [Body is file based: RemoteFile[TV2ZULU.xml]]
, Out: null:
]
--
View this message in context: http://camel.465427.n5.nabble.com/header-message-show-different-values-in-log-statements-tp5798372.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: header message show different values in log statements
Posted by "jan.schjoenning" <ja...@gmail.com>.
Thanks Doug !
Fine explanation - and make sense.
Reason for having log was to find out why parameters transfer to xslt were
"wrong"- so they will be removed from solution.
Regards
Jan
--
View this message in context: http://camel.465427.n5.nabble.com/header-message-show-different-values-in-log-statements-tp5798372p5798427.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: header message show different values in log statements
Posted by Doug Douglass <do...@gmail.com>.
On Wed, Apr 26, 2017 at 11:26 PM, jan.schjoenning <jan.schjoenning@gmail.com
> wrote:
> Given following route :
>
> from("direct:TranslateEpgData")
> .routeId("TranslateEpgData")
> .setHeader("xxx", constant("xxx"))
> .to("log:?showAll=true&multiline=true")
> .log("serviceId = ${header.serviceId}, scheduleStart =
> ${header.scheduleStart}, scheduleEnd = ${header.scheduleEnd}, originId =
> ${header.originId}")
> .to("log:?showAll=true&multiline=true")
> .to("xslt:whatson_to_tvanytime.xsl")
> .log("${body}");
>
> 1. log of ${header.serviceId} =
> serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6
>
> 2. log of ${header.serviceId} = TV2ZULU
>
> 3. log of ${header.serviceId} =
> serviceId=com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@7e5afaa6
>
> As flow states no changes between , why do i have this difference ?
>
>
Because .to("log:...") uses the Log Component[1] while .log("...") uses the
Log EIP[2], which uses the Simple language[3].
If you want .to("log:?showAll=true&multiline=true") to show the content of
the XML nodelist as .log("serviceId = ${header.serviceId}...") does, then
you should specify the result type when setting the header[4].
I've been caught by this before and have learned to always provide a result
type when using xpath expressions.
Hope that helps,
Doug
[1] http://camel.apache.org/log.html
[2] http://camel.apache.org/logeip.html
[3] http://camel.apache.org/simple.html
[4] http://camel.apache.org/simple.html#Simple-SettingtheResultType