Answer was: configure cache programatically (that is unexpected, I guess there is an issue in wildfly-clustering-infinispan-extension artifact...):

//    this.myAppCache = this.cacheContainer.getCache("myAppCache");
this.cacheContainer.defineConfiguration("dist", new ConfigurationBuilder()
    .clustering()
    .cacheMode(CacheMode.DIST_SYNC)
    .hash().numOwners(2)
    .build()
        );
this.myAppCache = this.cacheContainer.getCache("dist");

And now it works:

2016-02-02 12:20:25,925 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 7) Produce new cache entry 1454404825925 on node master:server-one
2016-02-02 12:20:26,008 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 8) Cache size on node master:server-one = 172

2016-02-02 12:20:26,009 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 5) Cache size on node master:server-two = 172



С уважением / Cordialement / Best regards,

Pierrick HYMBERT
pierrick.hymbert@gmail.com
(+7)916.301-89-13 / (+33)6.87-52-91-37

2016-01-31 14:59 GMT+03:00 Pierrick HYMBERT <pierrick.hymbert@gmail.com>:
Dear Wildfly dev team,

I am blocked to deploy a test app that use a distributed infinispan cache within 2 domain nodes and a cache entry producer deployed as clustered singleton service.
Your feedback/advise are really appreciated!

Cache definition:

                <cache-container name="my-cache-container">
                    <transport lock-timeout="60000"/>
                    <distributed-cache name="myAppCache" mode="SYNC">
                        <transaction mode="NONE"/>
                        <eviction strategy="NONE"/>
                    </distributed-cache>
                </cache-container>

Sample code:

  @Resource(lookup = "java:jboss/infinispan/container/my-cache-container")
  private EmbeddedCacheManager cacheContainer;

  private Cache<Long, Long> myAppCache;

  @PostConstruct
  public void startNotClustered() throws NamingException {
    this.myAppCache = this.cacheContainer.getCache("myAppCache");
    ...
  }

  ...

  @Schedule(hour = "*", minute = "*", second = "*")
  public void consume() {
    logger.info("Cache size on node {} = {}",
        System.getProperty("jboss.node.name"), myAppCache.size());
  }


Server one sample logs:
2016-01-31 14:52:03,789 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 1) Produce new cache entry 1454241123789 on node master:server-one
2016-01-31 14:52:04,005 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 2) Cache size on node master:server-one = 35
2016-01-31 14:52:04,796 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 3) Produce new cache entry 1454241124796 on node master:server-one
2016-01-31 14:52:05,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 4) Cache size on node master:server-one = 36
2016-01-31 14:52:05,801 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 5) Produce new cache entry 1454241125801 on node master:server-one
2016-01-31 14:52:06,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 6) Cache size on node master:server-one = 37
2016-01-31 14:52:06,807 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 7) Produce new cache entry 1454241126807 on node master:server-one
2016-01-31 14:52:07,005 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 8) Cache size on node master:server-one = 38
2016-01-31 14:52:07,813 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 9) Produce new cache entry 1454241127813 on node master:server-one
2016-01-31 14:52:08,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 10) Cache size on node master:server-one = 39
2016-01-31 14:52:08,817 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 1) Produce new cache entry 1454241128817 on node master:server-one
2016-01-31 14:52:09,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 2) Cache size on node master:server-one = 40

Server two logs:
2016-01-31 14:51:56,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 4) Cache size on node master:server-two = 0
2016-01-31 14:51:57,008 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 5) Cache size on node master:server-two = 0
2016-01-31 14:51:58,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 6) Cache size on node master:server-two = 0
2016-01-31 14:51:59,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 7) Cache size on node master:server-two = 0
2016-01-31 14:52:00,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 8) Cache size on node master:server-two = 0
2016-01-31 14:52:01,008 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 9) Cache size on node master:server-two = 0
2016-01-31 14:52:02,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 10) Cache size on node master:server-two = 0
2016-01-31 14:52:03,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 1) Cache size on node master:server-two = 0
2016-01-31 14:52:04,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 2) Cache size on node master:server-two = 0
2016-01-31 14:52:05,008 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 3) Cache size on node master:server-two = 0
2016-01-31 14:52:06,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 4) Cache size on node master:server-two = 0
2016-01-31 14:52:07,006 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 5) Cache size on node master:server-two = 0
2016-01-31 14:52:08,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 6) Cache size on node master:server-two = 0
2016-01-31 14:52:09,007 INFO  [org.hypik.test.jboss.eap7.server.TestService] (EJB default - 7) Cache size on node master:server-two = 0


I have attached all necessary info to investigate, but I am not sure attachement is allowed, so you can see source and logs here:


С уважением / Cordialement / Best regards,