camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-4178) WireTap should auto-convert streams to string so it always works by default
Date Fri, 06 Jul 2012 08:47:36 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-4178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-4178.
--------------------------------

       Resolution: Not A Problem
    Fix Version/s: Future
         Assignee: Claus Ibsen

Working as designed. Same issue with other EIPs when using streams. People should use stream
cache, or load the data into memory etc. Or use streams that can be re-read.
                
> WireTap should auto-convert streams to string so it always works by default
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-4178
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4178
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.7.2
>            Reporter: Josef Jahn
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: Future
>
>
> When wiretapping the result of a http request (to uri="http://foo"), the wiretap does
not work because the result is a stream. The developer has to remember to convert the result
to a string first to avoid the first consumption of the stream to make the data not available
for wiretapping.
> In the interest of "defaults that work", maybe the wiretap should "know" to handle streams
in a way that makes the wiretap work without extra consideration by the developer. Streams
could be auto-converted to string or, if the amount of data is larger than a certain pre-configured
threshold, cache them to disk and read the resulting file.
> Here's an example of a route that needs a convertBodyTo to make the wiretap work. Without
this, the wiretap quietly fails, and it can be quite time-consuming to try to find out why.
> {code:xml} 
> <route>
> 	<!-- jetty listening on port 8087 -->
> 	<from uri="jetty:http://0.0.0.0:8087/wsn/Broker"/>
> 	<!-- log input received -->
> 	<wireTap uri="file:data/recording?fileName=wsn-${date:now:yyyyMMdd}.log&amp;fileExist=Append">
> 		<body>
> 			<simple>[${date:now:dd.MM.yyyy hh:mm:ss}] [INCOMING REQUEST]: ${in.body}&#xA;&#xD;</simple>
> 		</body>
> 	</wireTap>
> 	<!-- send proxied request to actual web service -->
> 	<removeHeaders pattern="CamelHttp*"/>
> 	<removeHeader headerName="Accept-Encoding"/>
> 	<to uri="http://127.0.0.1:8192/wsn/Broker/"/>
> 	<!-- convert to string to prevent the stream to be consumed by the wiretap -->
> 	<convertBodyTo type="String"/>
> 	<!-- log answer from real web service -->
> 	<wireTap uri="file:data/recording?fileName=wsn-${date:now:yyyyMMdd}.log&amp;fileExist=Append">
> 		<body>
> 			<simple>[${date:now:dd.MM.yyyy hh:mm:ss}] [OUTGOING RESPONSE]: ${in.body}&#xA;&#xD;</simple>
> 		</body>
> 	</wireTap>
> </route>
> {code} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message