You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2012/04/17 07:46:07 UTC
[HEADS UP] - TypeConverter improved in Camel 2.10
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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Willem Jiang <wi...@gmail.com>.
The error was found after removing the converter of String to List
class in CXF.
The removed converter has covered the issue for a long time :(
On Tue Apr 24 10:39:56 2012, Hadrian Zbarcea wrote:
> I think you're totally mistaken in attributing the cause of the
> conversion to the a list of ActiveMQDestinations to the property
> editor. It doesn't even kick in. The converter from the activemq camel
> camel component kicked in and fooled you :).
>
> $0.02,
> Hadrian
>
> On 04/23/2012 10:27 PM, Willem Jiang wrote:
>> +1 for the new change.
>>
>> It's very confuse me that the a String can be turned into a List of
>> ActiveMQ in the CXF producer last week.
>> The fix make the camel converter more clean now :)
>>
>> On Tue Apr 24 02:46:41 2012, Claus Ibsen wrote:
>>> Hi
>>>
>>> Just a heads up that I just committed 2 changes trunk and 2.9 branches
>>>
>>> a)
>>> The java beans property editor is no longer used as fallback type
>>> converter by Camel.
>>>
>>> They are not thread safe, slow, and can cause unforseen side effects
>>> when adding JARs to a JVM.
>>> And they dont take generics into account so converting to a List /
>>> Array etc. Can trigger unforseen effects such as a String -> List
>>> will be converted to a List of ActiveMQDestination objects.
>>>
>>>
>>> b)
>>> optimized conversion to primitives.
>>> This is now faster.
>>>
>>> For example converting in a for loop 10.000 times runs now 5-10x
>>> faster :)
>>> Yeah its not the typical use-case, but a cheap way to see it runs
>>> faster.
>>>
>>>
>>>
>>> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen<cl...@gmail.com>
>>> 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/
>>>
>>>
>>>
>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>
--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Hadrian Zbarcea <hz...@gmail.com>.
I think you're totally mistaken in attributing the cause of the
conversion to the a list of ActiveMQDestinations to the property editor.
It doesn't even kick in. The converter from the activemq camel camel
component kicked in and fooled you :).
$0.02,
Hadrian
On 04/23/2012 10:27 PM, Willem Jiang wrote:
> +1 for the new change.
>
> It's very confuse me that the a String can be turned into a List of
> ActiveMQ in the CXF producer last week.
> The fix make the camel converter more clean now :)
>
> On Tue Apr 24 02:46:41 2012, Claus Ibsen wrote:
>> Hi
>>
>> Just a heads up that I just committed 2 changes trunk and 2.9 branches
>>
>> a)
>> The java beans property editor is no longer used as fallback type
>> converter by Camel.
>>
>> They are not thread safe, slow, and can cause unforseen side effects
>> when adding JARs to a JVM.
>> And they dont take generics into account so converting to a List /
>> Array etc. Can trigger unforseen effects such as a String -> List
>> will be converted to a List of ActiveMQDestination objects.
>>
>>
>> b)
>> optimized conversion to primitives.
>> This is now faster.
>>
>> For example converting in a for loop 10.000 times runs now 5-10x
>> faster :)
>> Yeah its not the typical use-case, but a cheap way to see it runs faster.
>>
>>
>>
>> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen<cl...@gmail.com>
>> 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/
>>
>>
>>
>
>
>
> --
> Willem
> ----------------------------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Web: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
--
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Willem Jiang <wi...@gmail.com>.
+1 for the new change.
It's very confuse me that the a String can be turned into a List of
ActiveMQ in the CXF producer last week.
The fix make the camel converter more clean now :)
On Tue Apr 24 02:46:41 2012, Claus Ibsen wrote:
> Hi
>
> Just a heads up that I just committed 2 changes trunk and 2.9 branches
>
> a)
> The java beans property editor is no longer used as fallback type
> converter by Camel.
>
> They are not thread safe, slow, and can cause unforseen side effects
> when adding JARs to a JVM.
> And they dont take generics into account so converting to a List /
> Array etc. Can trigger unforseen effects such as a String -> List
> will be converted to a List of ActiveMQDestination objects.
>
>
> b)
> optimized conversion to primitives.
> This is now faster.
>
> For example converting in a for loop 10.000 times runs now 5-10x faster :)
> Yeah its not the typical use-case, but a cheap way to see it runs faster.
>
>
>
> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen<cl...@gmail.com> 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/
>
>
>
--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Just a heads up that I just committed 2 changes trunk and 2.9 branches
a)
The java beans property editor is no longer used as fallback type
converter by Camel.
They are not thread safe, slow, and can cause unforseen side effects
when adding JARs to a JVM.
And they dont take generics into account so converting to a List /
Array etc. Can trigger unforseen effects such as a String -> List
will be converted to a List of ActiveMQDestination objects.
b)
optimized conversion to primitives.
This is now faster.
For example converting in a for loop 10.000 times runs now 5-10x faster :)
Yeah its not the typical use-case, but a cheap way to see it runs faster.
On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com> 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
I converted manually using JAXB directly, like this:
* final JAXBContext context = JAXBContext.newInstance(LafaList.class);*
* final Unmarshaller unMarshaller = context.createUnmarshaller();*
* LafaList lafaList = (LafaList) unMarshaller.unmarshal(new
StreamSource(new StringReader(theExchange.getIn().getBody(String.class))));*
This works while waiting for the next Camel release,
/Bengt
2012/4/18 Bengt Rodehav <be...@rodehav.com>
> Thanks for your suggestion Clause but the lookup in the type converter
> registry failed to find a type converter. Must be a fallback converter
> then. The LafaList class is a JAXB generated class which I assume would
> need the fallback converter.
>
> The only other workaround I can think of is to do the type conversion on
> my own. Do you have any other suggestions Clause?
>
> /Benk
>
>
> 2012/4/18 Claus Ibsen <cl...@gmail.com>
>
>> On Wed, Apr 18, 2012 at 10:10 AM, Bengt Rodehav <be...@rodehav.com>
>> wrote:
>> > BTW, is there a workaround that can be used in Camel 5.9.1?
>> >
>> > I have this today:
>> >
>> > LafaList lafaList = theExchange.getIn().getBody(LafaList.class);
>> >
>> > I've tried with this:
>> >
>> > LafaList lafaList =
>> > theExchange.getIn().getMandatoryBody(LafaList.class);
>> >
>>
>> It depends whether the conversion is using a regular type converter or
>> a fallback.
>>
>> If its a regular then you can look it up from the registry, and invoke
>> it manually.
>> Then the exception will be propagated to you.
>>
>> TypeConverter tc =
>> theExchange.getContext().getTypeConverterRegistry().lookup(LafaList.class,
>> theExchange.getIn().getBody.getClass());
>> if (tc != null) {
>> .. invoke me manually
>>
>>
>> However for a fallback TC its trickier. And hence why the JAXB
>> bug/issue was harder to track down.
>>
>>
>> > In the first case I get null if the type conversion fails (due to an
>> > invalid XML message). In the second case I get an exception.
>> Unfortunately
>> > both cases cause all subesequent conversions to fail even if the XML
>> > message is valid.
>> >
>> > Is there any way I can get this to work without having to wait for a new
>> > Camel version?
>> >
>> > /Bengt
>> >
>> > 2012/4/18 Bengt Rodehav <be...@rodehav.com>
>> >
>> >> +1
>> >>
>> >> I've just spent two days trying to figure out what I did wrong. I had
>> a
>> >> case where all subsequent xml conversions would fail after I tried to
>> >> process one xml message in invalid format. Then I found your post.
>> Good job
>> >> fixing it.
>> >>
>> >> /Bengt
>> >>
>> >>
>> >> 2012/4/17 Christian Müller <ch...@gmail.com>
>> >>
>> >>> +1,
>> >>>
>> >>> and thanks for your hard work...
>> >>>
>> >>> Best,
>> >>> Christian
>> >>>
>> >>> On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com>
>> >>> wrote:
>> >>>
>> >>> > Hi
>> >>> >
>> >>> > I am inclined to backport these changes to the 2.9 branch as I think
>> >>> > the bug from CAMEL-5164 would bite other people as well.
>> >>> > I have a workaround patch for 2.9 branch as work in progress. But I
>> >>> > dont feel its an optimal solution, as would the backport of the
>> >>> > changes from 2.10.
>> >>> >
>> >>> > There is only a slight API change in TypeConverter. Most people
>> would
>> >>> > use the @Converter for their custom converters, and if so, then they
>> >>> > are okay (no problem there). Only for people who implement the
>> >>> > TypeConverter directly, and then add that directly to the
>> >>> > TypeConverterRegistry API. Frankly I dont see this used at all by
>> end
>> >>> > users (The @Converter is mich simpler).
>> >>> >
>> >>> > However there is a slight change in the API from
>> Message.getBody(type)
>> >>> > and Message.getHeader(name, Type), as they would now throw a
>> >>> > TypeConversionException if failing. Where as beforehand a WARN would
>> >>> > be logged and null returned.
>> >>> >
>> >>> > IMHO the changes from 2.10 is better and also allows end users to be
>> >>> > in control of the failure first-hand. And frankly also what I would
>> >>> > expect from the call.
>> >>> >
>> >>> > If nobody scream, then we should get this backported for the next
>> 2.9.3
>> >>> > release.
>> >>> >
>> >>> > Any thoughts?
>> >>> >
>> >>> >
>> >>> > PS: I have attached my ugly workaround patch. We can use that as a
>> >>> > backup if someone scream really loud.
>> >>> >
>> >>> >
>> >>> >
>> >>> > On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <claus.ibsen@gmail.com
>> >
>> >>> > 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/
>>
>
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for your suggestion Clause but the lookup in the type converter
registry failed to find a type converter. Must be a fallback converter
then. The LafaList class is a JAXB generated class which I assume would
need the fallback converter.
The only other workaround I can think of is to do the type conversion on my
own. Do you have any other suggestions Clause?
/Benk
2012/4/18 Claus Ibsen <cl...@gmail.com>
> On Wed, Apr 18, 2012 at 10:10 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> > BTW, is there a workaround that can be used in Camel 5.9.1?
> >
> > I have this today:
> >
> > LafaList lafaList = theExchange.getIn().getBody(LafaList.class);
> >
> > I've tried with this:
> >
> > LafaList lafaList =
> > theExchange.getIn().getMandatoryBody(LafaList.class);
> >
>
> It depends whether the conversion is using a regular type converter or
> a fallback.
>
> If its a regular then you can look it up from the registry, and invoke
> it manually.
> Then the exception will be propagated to you.
>
> TypeConverter tc =
> theExchange.getContext().getTypeConverterRegistry().lookup(LafaList.class,
> theExchange.getIn().getBody.getClass());
> if (tc != null) {
> .. invoke me manually
>
>
> However for a fallback TC its trickier. And hence why the JAXB
> bug/issue was harder to track down.
>
>
> > In the first case I get null if the type conversion fails (due to an
> > invalid XML message). In the second case I get an exception.
> Unfortunately
> > both cases cause all subesequent conversions to fail even if the XML
> > message is valid.
> >
> > Is there any way I can get this to work without having to wait for a new
> > Camel version?
> >
> > /Bengt
> >
> > 2012/4/18 Bengt Rodehav <be...@rodehav.com>
> >
> >> +1
> >>
> >> I've just spent two days trying to figure out what I did wrong. I had a
> >> case where all subsequent xml conversions would fail after I tried to
> >> process one xml message in invalid format. Then I found your post. Good
> job
> >> fixing it.
> >>
> >> /Bengt
> >>
> >>
> >> 2012/4/17 Christian Müller <ch...@gmail.com>
> >>
> >>> +1,
> >>>
> >>> and thanks for your hard work...
> >>>
> >>> Best,
> >>> Christian
> >>>
> >>> On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com>
> >>> wrote:
> >>>
> >>> > Hi
> >>> >
> >>> > I am inclined to backport these changes to the 2.9 branch as I think
> >>> > the bug from CAMEL-5164 would bite other people as well.
> >>> > I have a workaround patch for 2.9 branch as work in progress. But I
> >>> > dont feel its an optimal solution, as would the backport of the
> >>> > changes from 2.10.
> >>> >
> >>> > There is only a slight API change in TypeConverter. Most people would
> >>> > use the @Converter for their custom converters, and if so, then they
> >>> > are okay (no problem there). Only for people who implement the
> >>> > TypeConverter directly, and then add that directly to the
> >>> > TypeConverterRegistry API. Frankly I dont see this used at all by end
> >>> > users (The @Converter is mich simpler).
> >>> >
> >>> > However there is a slight change in the API from
> Message.getBody(type)
> >>> > and Message.getHeader(name, Type), as they would now throw a
> >>> > TypeConversionException if failing. Where as beforehand a WARN would
> >>> > be logged and null returned.
> >>> >
> >>> > IMHO the changes from 2.10 is better and also allows end users to be
> >>> > in control of the failure first-hand. And frankly also what I would
> >>> > expect from the call.
> >>> >
> >>> > If nobody scream, then we should get this backported for the next
> 2.9.3
> >>> > release.
> >>> >
> >>> > Any thoughts?
> >>> >
> >>> >
> >>> > PS: I have attached my ugly workaround patch. We can use that as a
> >>> > backup if someone scream really loud.
> >>> >
> >>> >
> >>> >
> >>> > On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com>
> >>> > 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/
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 18, 2012 at 10:10 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> BTW, is there a workaround that can be used in Camel 5.9.1?
>
> I have this today:
>
> LafaList lafaList = theExchange.getIn().getBody(LafaList.class);
>
> I've tried with this:
>
> LafaList lafaList =
> theExchange.getIn().getMandatoryBody(LafaList.class);
>
It depends whether the conversion is using a regular type converter or
a fallback.
If its a regular then you can look it up from the registry, and invoke
it manually.
Then the exception will be propagated to you.
TypeConverter tc =
theExchange.getContext().getTypeConverterRegistry().lookup(LafaList.class,
theExchange.getIn().getBody.getClass());
if (tc != null) {
.. invoke me manually
However for a fallback TC its trickier. And hence why the JAXB
bug/issue was harder to track down.
> In the first case I get null if the type conversion fails (due to an
> invalid XML message). In the second case I get an exception. Unfortunately
> both cases cause all subesequent conversions to fail even if the XML
> message is valid.
>
> Is there any way I can get this to work without having to wait for a new
> Camel version?
>
> /Bengt
>
> 2012/4/18 Bengt Rodehav <be...@rodehav.com>
>
>> +1
>>
>> I've just spent two days trying to figure out what I did wrong. I had a
>> case where all subsequent xml conversions would fail after I tried to
>> process one xml message in invalid format. Then I found your post. Good job
>> fixing it.
>>
>> /Bengt
>>
>>
>> 2012/4/17 Christian Müller <ch...@gmail.com>
>>
>>> +1,
>>>
>>> and thanks for your hard work...
>>>
>>> Best,
>>> Christian
>>>
>>> On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com>
>>> wrote:
>>>
>>> > Hi
>>> >
>>> > I am inclined to backport these changes to the 2.9 branch as I think
>>> > the bug from CAMEL-5164 would bite other people as well.
>>> > I have a workaround patch for 2.9 branch as work in progress. But I
>>> > dont feel its an optimal solution, as would the backport of the
>>> > changes from 2.10.
>>> >
>>> > There is only a slight API change in TypeConverter. Most people would
>>> > use the @Converter for their custom converters, and if so, then they
>>> > are okay (no problem there). Only for people who implement the
>>> > TypeConverter directly, and then add that directly to the
>>> > TypeConverterRegistry API. Frankly I dont see this used at all by end
>>> > users (The @Converter is mich simpler).
>>> >
>>> > However there is a slight change in the API from Message.getBody(type)
>>> > and Message.getHeader(name, Type), as they would now throw a
>>> > TypeConversionException if failing. Where as beforehand a WARN would
>>> > be logged and null returned.
>>> >
>>> > IMHO the changes from 2.10 is better and also allows end users to be
>>> > in control of the failure first-hand. And frankly also what I would
>>> > expect from the call.
>>> >
>>> > If nobody scream, then we should get this backported for the next 2.9.3
>>> > release.
>>> >
>>> > Any thoughts?
>>> >
>>> >
>>> > PS: I have attached my ugly workaround patch. We can use that as a
>>> > backup if someone scream really loud.
>>> >
>>> >
>>> >
>>> > On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com>
>>> > 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
BTW, is there a workaround that can be used in Camel 5.9.1?
I have this today:
LafaList lafaList = theExchange.getIn().getBody(LafaList.class);
I've tried with this:
LafaList lafaList =
theExchange.getIn().getMandatoryBody(LafaList.class);
In the first case I get null if the type conversion fails (due to an
invalid XML message). In the second case I get an exception. Unfortunately
both cases cause all subesequent conversions to fail even if the XML
message is valid.
Is there any way I can get this to work without having to wait for a new
Camel version?
/Bengt
2012/4/18 Bengt Rodehav <be...@rodehav.com>
> +1
>
> I've just spent two days trying to figure out what I did wrong. I had a
> case where all subsequent xml conversions would fail after I tried to
> process one xml message in invalid format. Then I found your post. Good job
> fixing it.
>
> /Bengt
>
>
> 2012/4/17 Christian Müller <ch...@gmail.com>
>
>> +1,
>>
>> and thanks for your hard work...
>>
>> Best,
>> Christian
>>
>> On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com>
>> wrote:
>>
>> > Hi
>> >
>> > I am inclined to backport these changes to the 2.9 branch as I think
>> > the bug from CAMEL-5164 would bite other people as well.
>> > I have a workaround patch for 2.9 branch as work in progress. But I
>> > dont feel its an optimal solution, as would the backport of the
>> > changes from 2.10.
>> >
>> > There is only a slight API change in TypeConverter. Most people would
>> > use the @Converter for their custom converters, and if so, then they
>> > are okay (no problem there). Only for people who implement the
>> > TypeConverter directly, and then add that directly to the
>> > TypeConverterRegistry API. Frankly I dont see this used at all by end
>> > users (The @Converter is mich simpler).
>> >
>> > However there is a slight change in the API from Message.getBody(type)
>> > and Message.getHeader(name, Type), as they would now throw a
>> > TypeConversionException if failing. Where as beforehand a WARN would
>> > be logged and null returned.
>> >
>> > IMHO the changes from 2.10 is better and also allows end users to be
>> > in control of the failure first-hand. And frankly also what I would
>> > expect from the call.
>> >
>> > If nobody scream, then we should get this backported for the next 2.9.3
>> > release.
>> >
>> > Any thoughts?
>> >
>> >
>> > PS: I have attached my ugly workaround patch. We can use that as a
>> > backup if someone scream really loud.
>> >
>> >
>> >
>> > On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com>
>> > 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/
>> >
>>
>
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
+1
I've just spent two days trying to figure out what I did wrong. I had a
case where all subsequent xml conversions would fail after I tried to
process one xml message in invalid format. Then I found your post. Good job
fixing it.
/Bengt
2012/4/17 Christian Müller <ch...@gmail.com>
> +1,
>
> and thanks for your hard work...
>
> Best,
> Christian
>
> On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
>
> > Hi
> >
> > I am inclined to backport these changes to the 2.9 branch as I think
> > the bug from CAMEL-5164 would bite other people as well.
> > I have a workaround patch for 2.9 branch as work in progress. But I
> > dont feel its an optimal solution, as would the backport of the
> > changes from 2.10.
> >
> > There is only a slight API change in TypeConverter. Most people would
> > use the @Converter for their custom converters, and if so, then they
> > are okay (no problem there). Only for people who implement the
> > TypeConverter directly, and then add that directly to the
> > TypeConverterRegistry API. Frankly I dont see this used at all by end
> > users (The @Converter is mich simpler).
> >
> > However there is a slight change in the API from Message.getBody(type)
> > and Message.getHeader(name, Type), as they would now throw a
> > TypeConversionException if failing. Where as beforehand a WARN would
> > be logged and null returned.
> >
> > IMHO the changes from 2.10 is better and also allows end users to be
> > in control of the failure first-hand. And frankly also what I would
> > expect from the call.
> >
> > If nobody scream, then we should get this backported for the next 2.9.3
> > release.
> >
> > Any thoughts?
> >
> >
> > PS: I have attached my ugly workaround patch. We can use that as a
> > backup if someone scream really loud.
> >
> >
> >
> > On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com>
> > 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/
> >
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Christian Müller <ch...@gmail.com>.
+1,
and thanks for your hard work...
Best,
Christian
On Tue, Apr 17, 2012 at 11:38 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I am inclined to backport these changes to the 2.9 branch as I think
> the bug from CAMEL-5164 would bite other people as well.
> I have a workaround patch for 2.9 branch as work in progress. But I
> dont feel its an optimal solution, as would the backport of the
> changes from 2.10.
>
> There is only a slight API change in TypeConverter. Most people would
> use the @Converter for their custom converters, and if so, then they
> are okay (no problem there). Only for people who implement the
> TypeConverter directly, and then add that directly to the
> TypeConverterRegistry API. Frankly I dont see this used at all by end
> users (The @Converter is mich simpler).
>
> However there is a slight change in the API from Message.getBody(type)
> and Message.getHeader(name, Type), as they would now throw a
> TypeConversionException if failing. Where as beforehand a WARN would
> be logged and null returned.
>
> IMHO the changes from 2.10 is better and also allows end users to be
> in control of the failure first-hand. And frankly also what I would
> expect from the call.
>
> If nobody scream, then we should get this backported for the next 2.9.3
> release.
>
> Any thoughts?
>
>
> PS: I have attached my ugly workaround patch. We can use that as a
> backup if someone scream really loud.
>
>
>
> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com>
> 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/
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Hadrian Zbarcea <hz...@gmail.com>.
+1
Hadrian
On 04/17/2012 05:38 AM, Claus Ibsen wrote:
> Hi
>
> I am inclined to backport these changes to the 2.9 branch as I think
> the bug from CAMEL-5164 would bite other people as well.
> I have a workaround patch for 2.9 branch as work in progress. But I
> dont feel its an optimal solution, as would the backport of the
> changes from 2.10.
>
> There is only a slight API change in TypeConverter. Most people would
> use the @Converter for their custom converters, and if so, then they
> are okay (no problem there). Only for people who implement the
> TypeConverter directly, and then add that directly to the
> TypeConverterRegistry API. Frankly I dont see this used at all by end
> users (The @Converter is mich simpler).
>
> However there is a slight change in the API from Message.getBody(type)
> and Message.getHeader(name, Type), as they would now throw a
> TypeConversionException if failing. Where as beforehand a WARN would
> be logged and null returned.
>
> IMHO the changes from 2.10 is better and also allows end users to be
> in control of the failure first-hand. And frankly also what I would
> expect from the call.
>
> If nobody scream, then we should get this backported for the next 2.9.3 release.
>
> Any thoughts?
>
>
> PS: I have attached my ugly workaround patch. We can use that as a
> backup if someone scream really loud.
>
>
>
> On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen<cl...@gmail.com> 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/
>
>
>
--
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I am inclined to backport these changes to the 2.9 branch as I think
the bug from CAMEL-5164 would bite other people as well.
I have a workaround patch for 2.9 branch as work in progress. But I
dont feel its an optimal solution, as would the backport of the
changes from 2.10.
There is only a slight API change in TypeConverter. Most people would
use the @Converter for their custom converters, and if so, then they
are okay (no problem there). Only for people who implement the
TypeConverter directly, and then add that directly to the
TypeConverterRegistry API. Frankly I dont see this used at all by end
users (The @Converter is mich simpler).
However there is a slight change in the API from Message.getBody(type)
and Message.getHeader(name, Type), as they would now throw a
TypeConversionException if failing. Where as beforehand a WARN would
be logged and null returned.
IMHO the changes from 2.10 is better and also allows end users to be
in control of the failure first-hand. And frankly also what I would
expect from the call.
If nobody scream, then we should get this backported for the next 2.9.3 release.
Any thoughts?
PS: I have attached my ugly workaround patch. We can use that as a
backup if someone scream really loud.
On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com> 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
I'll try the next couple of days.
Thanks,
/Bengt
2012/4/18 Claus Ibsen <cl...@gmail.com>
> On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com>
> 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.
>
> 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 <cl...@gmail.com>
> 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/
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Christian Müller <ch...@gmail.com>.
+1
Best,
Christian
On Fri, Apr 20, 2012 at 12:24 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 7:23 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> > On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com>
> 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.
>
>
> > 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 <cl...@gmail.com>
> 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/
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Apr 23, 2012 at 10:10 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> I tried using the latest 2.10-SNAPSHOT (2.10-20120423.045830-94) and I can
> confirm that the fix works for me.
>
Thanks for verifying.
--
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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Bengt Rodehav <be...@rodehav.com>.
I tried using the latest 2.10-SNAPSHOT (2.10-20120423.045830-94) and I can
confirm that the fix works for me.
/Bengt
2012/4/21 Claus Ibsen <cl...@gmail.com>
> On Fri, Apr 20, 2012 at 12:24 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> > On Wed, Apr 18, 2012 at 7:23 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >> On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com>
> 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 <cl...@gmail.com>
> 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/
>
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Apr 20, 2012 at 12:24 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 7:23 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com> 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 <cl...@gmail.com> 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 18, 2012 at 7:23 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com> 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.
> 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 <cl...@gmail.com> 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 18, 2012 at 6:41 PM, Claus Ibsen <cl...@gmail.com> 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.
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 <cl...@gmail.com> 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/
Re: [HEADS UP] - TypeConverter improved in Camel 2.10
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Okay I found a little time, trying to do the backport. There is 3
commits in total.
On Tue, Apr 17, 2012 at 7:46 AM, Claus Ibsen <cl...@gmail.com> 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/