Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templates config option to the Mustache extension #868

Closed
ppalaga opened this issue Mar 10, 2020 · 8 comments
Closed

Add templates config option to the Mustache extension #868

ppalaga opened this issue Mar 10, 2020 · 8 comments
Assignees

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Mar 10, 2020

The mustache extension requires that the application developers use quarkus.native.additional-build-args =-H:ResourceConfigurationFiles=resources-config.json https://github.com/apache/camel-quarkus/pull/866/files#diff-8dd2b01ede99ee34a76c5e27361d4825R17 to add the templates to the native image.

This solution has several drawbacks:

  • It is not ergonomic
  • It is not consistent with how we did similar things in other extensions so far and
  • It breaks the portability of the test to quarkus-platform - one would have to copy the json file manually.

There are two ways this handled in other extensions:

  1. Include/exclude patterns like in https://github.com/apache/camel-quarkus/blob/master/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java#L75-L100

  2. List of files or directories like in 161ddb1#diff-56b018479519fc93fac85a776b5c285aR38

@lburgazzoli
Copy link
Contributor

Wonder if we can pre-compile the templates similar to what we have done for xslt, if the user still need to have the files then resources-config.json could be the way to go but will be user responsability

@lburgazzoli
Copy link
Contributor

Maybe we could also make a little easier to include resource files with properties like:

quarkus.camel.resources.includes  = ...
quarkus.camel.resources.excludes  = ...

@ppalaga
Copy link
Contributor Author

ppalaga commented Mar 10, 2020

Or even

quarkus.resources.includes  = ...
quarkus.resources.excludes  = ...

@ppalaga
Copy link
Contributor Author

ppalaga commented Mar 10, 2020

... which is to say that I like the general idea and that we should try to contribute it to Quarkus.

@lburgazzoli
Copy link
Contributor

Wonder if we can pre-compile the templates similar to what we have done for xslt, if the user still need to have the files then resources-config.json could be the way to go but will be user responsability

@aldettinger mind to check if this ^^^ would be possible ?

@aldettinger aldettinger self-assigned this Mar 11, 2020
@aldettinger
Copy link
Contributor

As far as I could drill, I've found no way to pre-compile templates on top of camel 3.1.

I'm thinking about complementing the mustache component with a kind of "mustache registry" (resourceUri -> pre-compiled-mustache-template). At endpoint creation time, the mustache component could then try to provide a pre-compiled mustache template according to the resource uri. OnExchange processing, the template is resolved with priority from header, then pre-compiled, then as usual.

On camel-quarkus side, I guess we would just need to record the "registry" / component initialization.

Maybe there is a way to skip the component level and make camel-quarkus store the "mustache registry" in the camel-registry... I don't know.

Any advices, inputs, pointers are welcome :)

@aldettinger
Copy link
Contributor

I may step back from the fully pre-compiled approach as I'm stuck on mustache object serialization to runtime init phase. I'll check other options.

aldettinger added a commit to aldettinger/camel-quarkus that referenced this issue Mar 23, 2020
aldettinger added a commit to aldettinger/camel-quarkus that referenced this issue Mar 23, 2020
aldettinger added a commit to aldettinger/camel-quarkus that referenced this issue Mar 23, 2020
@aldettinger
Copy link
Contributor

Mustache integration tests are now using include-patterns/exclude-patterns for resource inclusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants