camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Green <james.mk.gr...@gmail.com>
Subject Re: Modifying a shipped TypeConverter
Date Tue, 20 Jan 2015 15:58:41 GMT
Given MongoDB has an ISODate type natively, should the default ObjectMapper
be changed within the component itself to not write timestamps as longs?

I.e. should this be considered a bug..?

On 20 January 2015 at 15:29, Jakub Korab <jakub.korab.lists@gmail.com>
wrote:

> I haven't tried this, so it's just conjecture, but you could try to
> remove the offending type converter from the TypeConverterRegistry and
> replace it with your own:
>
> |CamelContext context = ...|
> |TypeConverterRegistry converterRegistry =
> context.getTypeConverterRegistry();
> ||converterRegistry.remove|||TypeConverter|(DBObject.class, Object.class);
> converterRegistry.addTypeConverter||(DBObject.class, Object.class, new
> FixedTypeConverter());|
>
> See:
>
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/TypeConverterRegistry.html#removeTypeConverter%28java.lang.Class,%20java.lang.Class%29
>
> Jakub
>
> On 20/01/15 14:50, James Green wrote:
> > The mongodb component uses Jackson to marshal Object to DBObject. The
> > trouble is that Date becomes long due to the default configuration of
> > Jackson.
> >
> > Is it possible to change this by obtaining that Jackson instance and
> > reconfiguring it?
> >
> > Or must be add a TypeConvertor for our specify type to the registry?
> >
> > Thanks,
> >
> > James
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message