That's nice.

I already found out you can write for example the throttle as:

.throttle(1).timePeriodMillis(1000)

Thus with two longs as input, but it's also possible:

.throttle(constant("{{maximumrequestcount}}")).timePeriodMillis("{{timeperiod}}")

In the second case the first parameter is an expression and the second
parameter a string.

It's thus flexible that both our possible. Is this now a standard that
object types will also become available as string or expression in the Java
DSL?

Raymond

On Tue, Sep 6, 2022 at 6:29 PM Claus Ibsen <claus.ib...@gmail.com> wrote:

> Ah yeah we need a timeout that takes a string value
>
> .pollEnrich("myUrl).timeout("xxx")....
>
> I just added that to 3.19 and 3.18.x
>
>
>
> On Tue, Sep 6, 2022 at 4:46 PM ski n <raymondmees...@gmail.com> wrote:
>
> > I like to create a route template with a parameter of a specific Java
> type.
> >
> > For example the following routetemplate:
> >
> > routeTemplate("mypollenrich")
> >         .templateParameter("timeout","5000")
> >         .from("direct:in")
> >         .pollEnrich("myuri", "{{timeout}}","CurrentEnrichStrategy")
> >                 .to("direct:out");
> >
> > The above routetemplate is not accepted because the parameter
> "{{timeout}}"
> > is a String, while a long is expected. Is it possible to pass the
> parameter
> > as a long (and in general just any Java type)?
> >
> > I now tried to parse the String as Long like this:
> >
> > routeTemplate("mypollenrich")
> >         .templateParameter("timeout","5000")
> >         .from("direct:in")
> >         .pollEnrich("myuri",
> > Long.parseLong("{{timeout}}"),"CurrentEnrichStrategy")
> >                 .to("direct:out");
> >
> > But doesn't seem allowed. What is the correct way of doing it?
> >
> > Raymond
> >
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Reply via email to