quarkusio / quarkus-quickstarts

Quarkus quickstart code
https://quarkus.io
Apache License 2.0
1.95k stars 1.46k forks source link

Infinispan quickstart issues / improvements #392

Closed cescoffier closed 1 year ago

cescoffier commented 4 years ago

There are few issues / improvements around the infinispan quickstart:

Currently, it uses some XML snippets added at startup:

void onStart(@Observes StartupEvent ev) {
      LOGGER.info("Create or get cache named mycache with the default configuration");
      RemoteCache<Object, Object> cache = cacheManager.administration().getOrCreateCache("mycache", new XMLStringConfiguration(String.format(CACHE_CONFIG, "mycache")));
      cache.put("hello", "Hello World, Infinispan is up!");
   }

Once in a while, I get a 204, most probably because the cache does not have the value yet or something else. I also get 500, with the cache not being injected in the resource. These issues happen only in native mode.

cescoffier commented 4 years ago

Issues can be reproduced with: https://github.com/quarkusio/quarkus-quickstarts/pull/352

cescoffier commented 4 years ago

@karesti can you have a look?

emmanuelbernard commented 4 years ago

On the race condition, CC @wburns

stephennimmo commented 2 years ago

I think the race condition is actually within the CDI context. The StartupEvent can run after the RemoteCache beans are attempted to be injected using the @Remote annotation, resulting in a WARN from the hotrod client. Example:

ISPN004005: Error received from the server: org.infinispan.server.hotrod.CacheNotFoundException: Cache with name 'settlement-data-historical' not found amongst the configured caches

Ultimately, the work should be to extend the devservices InfinispanDevServiceProcessor to consume additional configuration to allow for the creation of caches. Something like:

quarkus.infinispan-client.devservices.caches.cache-name1.template=DIST_SYNC quarkus.infinispan-client.devservices.caches.cache-name2.template=DIST_SYNC

karesti commented 1 year ago

This has been already fixed