Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D1686905F for ; Sat, 21 Apr 2012 10:02:14 +0000 (UTC) Received: (qmail 78540 invoked by uid 500); 21 Apr 2012 10:02:14 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 78204 invoked by uid 500); 21 Apr 2012 10:02:09 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 78151 invoked by uid 99); 21 Apr 2012 10:02:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Apr 2012 10:02:07 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Apr 2012 10:02:00 +0000 Received: by lboi15 with SMTP id i15so5092410lbo.32 for ; Sat, 21 Apr 2012 03:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=eK0VRmVy8/Jpd23/6o9TJ04oaAEvRCWHiUl44DNfL4o=; b=gqC0sxFI74rTM5ZQ1dFbtHVGLKn96wLuLwGUTpLG/dx6IK9az8abVIV0zMs+L2SMFn NiVHyj5uC7lZV7i7Xr+E3XsUlY/aGGmn9HvRhh2/Q8Pszw3LFJNzvPPAvUCf4YPwSQ2N 8anCoU95/rx0s9nazQ7X+Jo1xJiWxSQTW/KjqwAjfElWlWntlT7ejtK1/YyS2miQLu0j XGsP+z1xpQ1Wh73WX6HKF6BBWRagTODvkA3+IZ+zRuDdOeH5+k2BG0nn2oezzfFvN7/V w/tBKJpbyaq111VdM9Hw0x5a42G4pylCkS6B8DI5l1DmZOfrBvcdq2DIjbRKpxvpl3YV xDtg== Received: by 10.112.98.70 with SMTP id eg6mr4525688lbb.13.1335002498191; Sat, 21 Apr 2012 03:01:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.75.130 with HTTP; Sat, 21 Apr 2012 03:01:17 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Sat, 21 Apr 2012 12:01:17 +0200 Message-ID: Subject: Re: [HEADS UP] - TypeConverter improved in Camel 2.10 To: dev Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Apr 20, 2012 at 12:24 PM, Claus Ibsen wrote: > On Wed, Apr 18, 2012 at 7:23 PM, Claus Ibsen wrote: >> On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen wrote: >>> Hi >>> >>> Okay I found a little time, trying to do the backport. There is 3 >>> commits in total. >>> >> >> Okay backported to 2.9 branch. >> > > I would like to backport to the 2.8 branch as well, so it can make it > into the next 2.8 release. > Okay I have backported this to the 2.8 branch now. > >> Bengt you are of course welcome to test the 2.9.3-SNAPSHOT on your end >> if it fixed the issue onwards. >> >> >>> >>> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen wrote: >>>> Hi >>>> >>>> Recently I have spent some time to improve the type converters in Camel 2.10. >>>> >>>> Most significant is the following changes >>>> a) fix important bug >>>> b) Fail fast >>>> c) tryConvertTo >>>> d) Expose utilization statistics >>>> >>>> >>>> Ad a) >>>> A bug was reported in https://issues.apache.org/jira/browse/CAMEL-5164 >>>> >>>> In summary if using camel-jaxb that offers a fallback type converter, >>>> and a failure occurs during XML marshalling, >>>> then subsequent new XML messages may fail, despite they were okay. >>>> >>>> Ad b) >>>> Due to a we need to detect this faster and better. So now the type >>>> converter system in Camel will fail fast >>>> by throwing a new TypeConversionException (its runtime). That allows >>>> Camel to detect the (a) failure faster >>>> from a fallback type converter (regular non fallback would fail fast already) >>>> >>>> This means the API is also consistent from caller point of view. You >>>> get a TypeConversionException if there >>>> was a failure during a type conversion attempt. >>>> >>>> Ad c) >>>> There is some places in camel-core where we want to only try to >>>> convert. For example with the binary predicates >>>> where you want to compare if X > Y. Then we try to coerce X and Y to >>>> numeric values. >>>> >>>> Likewise there is a few other spots where we do this, such as the XSLT >>>> component, where we try to use StAX, SAX, before DOM etc. >>>> So we have introduced a tryConvertTo API, which would not fail during >>>> type conversion. >>>> >>>> Ad d) >>>> The type converter system is used a lot in Camel during routing >>>> messages. Now we expose utilization statistics, >>>> which allow end users to spot if there is too many missing type >>>> conversion attempts. For example a route may attempt to convert, where >>>> there is no suitable type converter. This can now more easily be >>>> spotted, allowing the end user to either. Implement such a missing >>>> type converter, or >>>> correct a mistake in his application or the likes. >>>> >>>> The statistics is exposed in JMX and as well when Camel shutdown as a log line. >>>> >>>> >>>> >>>> >>>> On another note I am also hunting down to avoid using the >>>> PropertiesEditorTypeConverter, as it has many flaws >>>> - its not thread safe >>>> - its slow >>>> - and 3rd party projects can add property editors that influence >>>> Camel's type converts (eg ActiveMQ has a String -> List) properties >>>> editor that turns a String into a List of ActiveMQDestination >>>> instances. >>>> - it does not understand generics in List/Collection type, eg the >>>> ActiveMQ example above >>>> >>>> And basically we uses it only in Camel for doing some of the simpler >>>> basic conversions: String <-> Numeric. And so forth. But over the time >>>> we have added those as type converter directly in Camel, as they are >>>> faster as well. >>>> >>>> >>>> >>>> >>>> -- >>>> Claus Ibsen >>>> ----------------- >>>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >>>> FuseSource >>>> Email: cibsen@fusesource.com >>>> Web: http://fusesource.com >>>> Twitter: davsclaus, fusenews >>>> Blog: http://davsclaus.blogspot.com/ >>>> Author of Camel in Action: http://www.manning.com/ibsen/ >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >>> FuseSource >>> Email: cibsen@fusesource.com >>> Web: http://fusesource.com >>> Twitter: davsclaus, fusenews >>> Blog: http://davsclaus.blogspot.com/ >>> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> >> >> -- >> Claus Ibsen >> ----------------- >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> FuseSource >> Email: cibsen@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ > > > > -- > Claus Ibsen > ----------------- > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cibsen@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/