I tried to use the cache listener to get the call back on cacheEntryCreatedEvent.
I know there were many previous posts on how to get the value of entry assoicated event. Basically, we do not have a good way. CacheEntryModified event will give us the value when isPre=false. But, in my case, I need to differentiate creation from modification.
Anyway, one workaround of this issue I came up is the following:
...
@CacheEntryCreated
public void createdCallback(CacheEntryCreatedEvent e) {
if (!e.isPre) {
Object value = e.getCache().get(e.getKey());
}
}
However, the above code behaves differently between local node and remote nodes in a cluster (REPLICATION).
On local node, the value is null,
but on remont nodes, I get the valid value for the entry.
Is anyone know why on the local node, the get() returns null? Is there other way to retrieve the value for the key assoicated with the create event?
Note: I can not use the modifyEvent for this.