ppalaga commented on issue #1846:
URL: https://github.com/apache/camel-quarkus/issues/1846#issuecomment-1245107767

   @javaduke thanks, this looks very promising. The tests are especially 
valuable. 
   
   Here some notes:
   
   * `com.github.ben-manes.caffeine:caffeine` is already managed in 
`io.quarkus:quarkus-bom` `com.github.ben-manes.caffeine:jcache` is missing, the 
right place for it is `camel-quarkus-bom` using a new version property 
`caffeine.version` that  we need to bind to the version used in Quarkus through 
the `@sync` statement, something like 
   
   ```
   <caffeine.version></caffeine.version><!-- @sync 
io.quarkus:quarkus-bom:${quarkus.version} 
dep:com.github.ben-manes.caffeine:jcache -->
   ```
   
   and run `mvn cq:sync-versions -N -e` afterwards.
   
   * No change is required iin `camel-quarkus-bom-test`
   * I wonder if all reflection registrations done in 
JcacheCaffeineReflectionConfiguration would be still needed if we add a 
dependency on `io.quarkus:quarkus-caffeine`? 
   * `JcacheProcessor` should make the JCache SPI 
`javax.cache.spi.CachingProvider` honored via `ServiceProviderBuildItem`. 
Something like
   
   ```
       @BuildStep
       void nativeResources(BuildProducer<ServiceProviderBuildItem> services,
               BuildProducer<NativeImageResourceBuildItem> nativeResources) {
           Stream.of("javax.cache.spi.CachingProvider")
                   .forEach(service -> {
                       try {
                           Set<String> implementations = 
ServiceUtil.classNamesNamedIn(
                                   
Thread.currentThread().getContextClassLoader(),
                                   "META-INF/services/" + service);
                           services.produce(
                                   new ServiceProviderBuildItem(service, 
implementations));
                       } catch (IOException e) {
                           throw new RuntimeException(e);
                       }
                   });
   ```
   
   After doing that, the minimal setup with just `.policy(new JCachePolicy())` 
mentioned on [camel 
docs](https://camel.apache.org/components/3.18.x/jcache-component.html#_find_cachemanager)
 could perhaps work (given that com.github.ben-manes.caffeine:jcache is in 
class path).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to