Camel Quarkus toD with dynamic values?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel Quarkus toD with dynamic values?

hakuseki
Hi

trying to convert a small Camel application to Quarkus but fails on this:

                from(timer("{{esma.download.timer}}").repeatCount(1))
                .log("{{esma.download.url}}")
                .toD(https("{{esma.download.url}}"))
esma:
  download:
    url : registers.esma.europa.eu/solr/esma_registers_firds_files/select?q=*&fq=publication_date:%5B${date:now-72h:yyyy-MM-dd}T00:00:00Z%20TO%20${date:now-24h:yyyy-MM-dd}T23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100



first it cannot interpret the log it prints “{{esma.download.url}}” to the console

then it doesn’t convert my simple date calculations in the string

What do i need to make this happen?

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>${quarkus.platform.group-id}</groupId>
            <artifactId>${quarkus.platform.artifact-id}</artifactId>
            <version>${quarkus.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.quarkus</groupId>
            <artifactId>camel-quarkus-bom</artifactId>
            <version>1.0.0-M6</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
Other “{{}}” values in the from/to endpoints work…

Thx

M
Reply | Threaded
Open this post in threaded view
|

Re: Camel Quarkus toD with dynamic values?

rafaeltuelho
Try to use the "URI STRING FORMATTING" *toF()* and *fromF()*...

from("direct:start").*toF*("file://%s?fileName=%s", path, name); *fromF*(
"file://%s?include=%s", path, pattern).toF("mock:%s", result);

Also, inject your properties using the Quarkus Microprofile @ConfigProperty
(org.eclipse.microprofile.config.inject.ConfigProperty)


________________________
Rafael Torres Coelho Soares


On Mon, Apr 20, 2020 at 9:12 AM Mikael Andersson Wigander <
[hidden email]> wrote:

> Hi
>
> trying to convert a small Camel application to Quarkus but fails on this:
>
>                 from(timer("{{esma.download.timer}}").repeatCount(1))
>                 .log("{{esma.download.url}}")
>                 .toD(https("{{esma.download.url}}"))
> esma:
>   download:
>     url :
> registers.esma.europa.eu/solr/esma_registers_firds_files/select?q=*&fq=publication_date:%5B${date:now-72h:yyyy-MM-dd}T00:00:00Z%20TO%20${date:now-24h:yyyy-MM-dd}T23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100
> <http://registers.esma.europa.eu/solr/esma_registers_firds_files/select?q=*&fq=publication_date:%5B$%7Bdate:now-72h:yyyy-MM-dd%7DT00:00:00Z%20TO%20$%7Bdate:now-24h:yyyy-MM-dd%7DT23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100>
>
>
>
> first it cannot interpret the log it prints “{{esma.download.url}}” to the
> console
>
> then it doesn’t convert my simple date calculations in the string
>
> What do i need to make this happen?
>
> <dependencyManagement>
>     <dependencies>
>         <dependency>
>             <groupId>${quarkus.platform.group-id}</groupId>
>             <artifactId>${quarkus.platform.artifact-id}</artifactId>
>             <version>${quarkus.platform.version}</version>
>             <type>pom</type>
>             <scope>import</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.quarkus</groupId>
>             <artifactId>camel-quarkus-bom</artifactId>
>             <version>1.0.0-M6</version>
>             <type>pom</type>
>             <scope>import</scope>
>         </dependency>
>     </dependencies>
> </dependencyManagement>
> Other “{{}}” values in the from/to endpoints work…
>
> Thx
>
> M
Reply | Threaded
Open this post in threaded view
|

Re: Camel Quarkus toD with dynamic values?

Claus Ibsen-2
In reply to this post by hakuseki
Hi

What version of Camel are you using? I think we had a bug in
endpoint-dsl with {{ }} placeholders, that only has been fixed in the
upcoming 3.3 release.
And it may work in older Camel like 3.1.0. Or dont use the endpoint
dsl and regular camel uri strings

On Mon, Apr 20, 2020 at 3:11 PM Mikael Andersson Wigander
<[hidden email]> wrote:

>
> Hi
>
> trying to convert a small Camel application to Quarkus but fails on this:
>
>                 from(timer("{{esma.download.timer}}").repeatCount(1))
>                 .log("{{esma.download.url}}")
>                 .toD(https("{{esma.download.url}}"))
> esma:
>   download:
>     url : registers.esma.europa.eu/solr/esma_registers_firds_files/select?q=*&fq=publication_date:%5B${date:now-72h:yyyy-MM-dd}T00:00:00Z%20TO%20${date:now-24h:yyyy-MM-dd}T23:59:59Z%5D&wt=xml&indent=false&start=0&rows=100
>
>
>
> first it cannot interpret the log it prints “{{esma.download.url}}” to the console
>
> then it doesn’t convert my simple date calculations in the string
>
> What do i need to make this happen?
>
> <dependencyManagement>
>     <dependencies>
>         <dependency>
>             <groupId>${quarkus.platform.group-id}</groupId>
>             <artifactId>${quarkus.platform.artifact-id}</artifactId>
>             <version>${quarkus.platform.version}</version>
>             <type>pom</type>
>             <scope>import</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.quarkus</groupId>
>             <artifactId>camel-quarkus-bom</artifactId>
>             <version>1.0.0-M6</version>
>             <type>pom</type>
>             <scope>import</scope>
>         </dependency>
>     </dependencies>
> </dependencyManagement>
> Other “{{}}” values in the from/to endpoints work…
>
> Thx
>
> M



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2