3 Replies Latest reply on Dec 7, 2016 9:24 AM by seto

    Hi. Several questions to ask about Infinispan and CDI.

    seto

      1. How to configure cache with CDI annotations to specify the cache mode? I mean configuring as "configuring caches declaratively" in the configuration chapter.

      2. About clustering, how to get the information about the clustering? Like node identifier or something similar. I'm using it in SE environment.

        • 1. Re: Hi. Several questions to ask about Infinispan and CDI.
          seto

          I know the answer to question 1 now, but still have no idea about question 2.

           

             @ConfigureCache("name-cache")

             @NameCache
            @Produces
             public Configuration nameCacheConfig;

             @ConfigureCache("id-cache")

             @IdCache
            @Produces
             public Configuration idCacheConfig;

             @ConfigureCache("local-name-cache")

             @LocalNameCache
            @Produces
             public Configuration localNameCacheConfig()

            {

             return localConfig();
             }

           

             @ConfigureCache("local-id-cache")

             @LocalIdCache
            @Produces
             public Configuration localIdCacheConfig()

            {

             return localConfig();
             }

           

             private Configuration localConfig()

            {

            ConfigurationBuilder builder = new ConfigurationBuilder();
             builder.clustering().cacheMode(CacheMode.LOCAL);
            return builder.build();
             }

          • 2. Re: Hi. Several questions to ask about Infinispan and CDI.
            sebastian.laskawiec

            The CDI extension creates an EmbeddedCacheManager for you. All you need to do is to inject it (@Inject EmbeddedCacheManager cacheManager) and invoke cacheManager.getTransport().getMembers() (or getAddress()).

            • 3. Re: Hi. Several questions to ask about Infinispan and CDI.
              seto

              Thank you. That's what I'm finding. It's not mentioned in the documentation.