And you can use a processor or bean with the producer template to do a wiretap where you can create whatever you want to send.
The wiretap is also capable of setting a new exchange but what it does lack is access to the old exchange, which may be a new feature to add in the future. http://camel.apache.org/wire-tap.html On Fri, Sep 11, 2009 at 11:46 AM, Claus Ibsen <[email protected]> wrote: > On Fri, Sep 11, 2009 at 11:37 AM, HariKrishnan <[email protected]> > wrote: >> >> Hey, >> >> Looks like this exception is happening because, wiretap is using the same >> Exchange object that is being return back from the actual endpoint. >> >> from(a).to(b).wiretap(cxf:bean). >> >> Let me clarify as to why we are using wiretap after endpoint b. We want the >> return of endpoint b to go to cxf bean. Also return back through the route >> without any changes because of wiretap processing. >> >> Ideally since wiretap is a new thread, it should use a copy of the echange, >> so that any changes it makes to the echange should not affect the return >> value. >> Is there any way we can send a copy of the exchange to wiretap, than sending >> the same exchange. > > It does use a copy of the Exchange its just the payload that cannot be > cloned/copied in a generic fashion in Java land. > > So the key is to copy the payload without affecting the original which > is hardly possible with streams. > > > >> >> Regards, >> HariKrishnan >> >> >> >> Claus Ibsen-2 wrote: >>> >>> On Thu, Sep 10, 2009 at 11:32 PM, HariKrishnan <[email protected]> >>> wrote: >>>> >>>> Hi, >>>> >>>> Irrespective of whether there is an endpoint after a wiretap, the CXF >>>> bean >>>> is seems to have the same problem. If my understanding correct, the >>>> exchange >>>> body is always a stream. The exception that we are talking about >>>> (Premature >>>> End of File) usually happens with streams if they are not closed of >>>> Flushed. >>>> I have tried using setStreamChaching(true). But that does not work >>>> either. >>>> >>> >>> Can you post the full route and point where you configured the stream >>> caching. >>> And what version of Camel are you using? >>> >>> Adding a .convertBodyTo(String.class) usually remedies this problem >>> with streams. But yet again the stream cache should help as well. >>> >>> >>>> Thanks, >>>> HariKrishnan >>>> >>>> >>>> >>>> Mick Knutson-3 wrote: >>>>> >>>>> Try: >>>>> >>>>> from(a).wiretap(cxf:bean)*.to(b)* >>>>> >>>>> fwik, the wiretap is a middle point before sending to another endpoint. >>>>> >>>>> --- >>>>> Thank You… >>>>> >>>>> Mick Knutson, President >>>>> >>>>> BASE Logic, Inc. >>>>> Enterprise Architecture, Design, Mentoring & Agile Consulting >>>>> p. (866) BLiNC-411: (254-6241-1) >>>>> f. (415) 685-4233 >>>>> >>>>> Website: http://baselogic.com >>>>> Linked IN: http://linkedin.com/in/mickknutson >>>>> Vacation Rental: http://tahoe.baselogic.com >>>>> --- >>>>> >>>>> >>>>> >>>>> On Thu, Sep 10, 2009 at 1:04 PM, HariKrishnan >>>>> <[email protected]>wrote: >>>>> >>>>>> >>>>>> Hey, >>>>>> >>>>>> We are using CXF bean to act as a RESTful endpoint. >>>>>> It seems to work fine when we configure the route as shown below. We >>>>>> post >>>>>> an >>>>>> xml to the url and that gets unmarshalled and sent to the CXF bean. >>>>>> >>>>>> from(url).to(cxf:bean) >>>>>> >>>>>> But when we use a wiretap component, there is a "Premature end of file >>>>>> exception". >>>>>> >>>>>> from(a).to(b).wiretap(cxf:bean) >>>>>> >>>>>> We tried setting the setStreamingCache to true, but that was of no >>>>>> avail. >>>>>> >>>>>> Please let us know if we are missing something here. >>>>>> >>>>>> Thanks, >>>>>> HariKrishnan >>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/Premature-End-of-File-Exception-in-Camel-wiretap-tp25387224p25387224.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Premature-End-of-File-Exception-in-Camel-wiretap-tp25387224p25391416.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Premature-End-of-File-Exception-in-Camel-wiretap-tp25387224p25397979.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
