@@ -0,0 +1,1579 @@
+package cz.jurankovi.demo.ispn.tf;%0A%0Aimport java.nio.ByteBuffer;%0A%0Aimport org.infinispan.client.hotrod.RemoteCache;%0Aimport org.infinispan.client.hotrod.annotation.ClientCacheEntryCreated;%0Aimport org.infinispan.client.hotrod.annotation.ClientCacheEntryModified;%0Aimport org.infinispan.client.hotrod.annotation.ClientListener;%0Aimport org.infinispan.client.hotrod.event.ClientCacheEntryCustomEvent;%0Aimport org.infinispan.commons.io.UnsignedNumeric;%0A%0A@ClientListener(converterFactoryName = %22string-byte-array-converter-factory%22)%0Apublic class MnistListener %7B%0A%0A%09private final MnistTwoHiddenLayersClassifier classifier;%0A%09private final RemoteCache%3CString, String%3E resultCache;%0A%09%0A%09public MnistListener(String modelPath, String checkpointPath, RemoteCache%3CString, String%3E resultCache) %7B%0A%09%09this.classifier = new MnistTwoHiddenLayersClassifier(modelPath, checkpointPath);%0A%09%09this.resultCache = resultCache;%0A%09%7D%0A%09%0A%09@ClientCacheEntryCreated%0A%09@ClientCacheEntryModified%0A%09public void onCacheEvent(ClientCacheEntryCustomEvent%3Cbyte%5B%5D%3E e) %7B%0A%09%09ByteBuffer buffer = ByteBuffer.wrap(e.getEventData());%0A%09%09int keyLength = UnsignedNumeric.readUnsignedInt(buffer);%0A%09%09byte%5B%5D keyBytes = new byte%5BkeyLength%5D;%0A%09%09buffer.get(keyBytes);%0A        String key = new String(keyBytes);%0A        int valueLength = UnsignedNumeric.readUnsignedInt(buffer);%0A        byte valueBytes%5B%5D = new byte%5BvalueLength%5D; %0A        buffer.get(valueBytes);%0A        %0A%09%09String result = classifier.processEvent(key, valueBytes);%0A%09%09resultCache.put(key, result);%0A%09%09System.out.printf(%22On the image with ID %25s could be number %25s%5Cn%22, key, result);%0A%09%7D%0A%7D%0A

Add Ispn listener