Thanks Claus it helps a lot.

Though I also found one way also and i.e.
camelContext.setLoadTypeConverters(true); this also helped in loading
the converters...

Now there is a different challenge, I am having below route

from(Endpoints.COMMAND_CRYPTIC)
   .convertBodyTo(CommandCryptic.class)
   .setProperty(JAXWS_METHOD_NAME_PROPERTY, constant("Command_Cryptic"))
   .to("direct:commandEntryPoint")
.convertBodyTo(String.class)
.routeId("commandCrypticRoute");


So, with older version (2.5) of camel this was working properly and I
was able to get the response in String format properly (PS: there is a
toString() converter converting Object to String), but with new
version of camel this toString() converter is not getting invoked.

I tried to replace the convertBodyTo() with process() method and apply
logic inside process() then it worked though.

So, my question is that is there any way by which I can keep on using
convertBodyTo()?

Looking forward to hearing from you

On Wed, Oct 18, 2023 at 11:30 AM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
> Hi
>
> If you want to use generateLoader=true (you should only set this on class
> annotation).
> Then you need to use the camel-component-maven-plugin as well that
> generates needed metadata files.
>
> Otherwise you can use the old 2.x way, where you need to turn on type
> converter classpath scanner.
>
> https://camel.apache.org/manual/type-converter.html#_type_converter_registry
>
> On Tue, Oct 17, 2023 at 5:33 PM Kushagra Bindal <bindal.kusha...@gmail.com>
> wrote:
>
> > Hi,
> >
> > While trying to migrate from Camel2-->Camel4, I am facing one
> > challenge i.e. earlier in one of my class I use to have multiple
> > converter methods which was working fine. But now with latest version,
> > I observed that only 1st method of the converter class is loaded and
> > rest are not loaded.
> >
> > @Converter(generateLoader = true)
> > public class CommandConverter {
> >
> >
> > @Converter(generateLoader = true)
> > public final CommandCost toCommandCost(final String command) {
> > ..
> > ..
> > ..
> > }
> >
> > @Converter(generateLoader = true)
> > public final CommandCost1 toCommandCost1(final String command1) {
> > ..
> > ..
> > ..
> > }
> >
> > @Converter(generateLoader = true)
> > public final CommandCost2 toCommandCost2(final String command2) {
> > ..
> > ..
> > ..
> > }
> >
> > }
> >
> > In above example earlier all 3 mappings use to get reflected in
> > typeMapping but now with camel4 it is only showing 1st mapping
> > (toCommandCost)
> > Am I missing something? If there any configuration or dependency that
> > needs to be added in pom.xml or somewhere else to make it working then
> > please let me know.
> >
> > --
> > Regards,
> > Kushagra
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Regards,
Kushagra

Reply via email to