CAMEL-8290

On 28 January 2015 at 11:22, Raul Kripalani <[email protected]> wrote:

> Yes, we definitely need an option to pick up a custom ObjectMapper. Could
> you file a JIRA and assign it to me, please?
>
> However, the type converter is only used as a (very convenient) fallback.
> If you provide a DBObject to your endpoint, no type conversions will be
> triggered.
>
> Therefore, for now, you can just implement a processor/bean to convert your
> custom Object into a DBObject with a code similar to [1], but controlling
> whichever options you want in the ObjectMapper.
>
> [1]
>
> https://github.com/raulk/camel-mongodb/blob/master/src/main/java/org/apache/camel/component/mongodb/converters/MongoDbBasicConverters.java#L67
>
> Hope that helps,
>
> *Raúl Kripalani*
> Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
> Integration specialist
> http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
> http://blog.raulkr.net | twitter: @raulvk
>
> On Tue, Jan 20, 2015 at 3:58 PM, James Green <[email protected]>
> wrote:
>
> > 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 <[email protected]>
> > 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
> > > >
> > >
> > >
> >
>

Reply via email to