generated from telekom/reuse-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added map entry listener on json cache service using spring events
- Loading branch information
Showing
8 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...main/java/de/telekom/eni/pandora/horizon/cache/service/JsonCacheServiceEntryListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package de.telekom.eni.pandora.horizon.cache.service; | ||
|
||
import com.hazelcast.core.EntryEvent; | ||
import com.hazelcast.core.HazelcastJsonValue; | ||
import com.hazelcast.map.listener.EntryAddedListener; | ||
import com.hazelcast.map.listener.EntryEvictedListener; | ||
import com.hazelcast.map.listener.EntryRemovedListener; | ||
import com.hazelcast.map.listener.EntryUpdatedListener; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
|
||
public class JsonCacheServiceEntryListener implements EntryAddedListener<String, HazelcastJsonValue>, | ||
EntryRemovedListener<String, HazelcastJsonValue>, | ||
EntryUpdatedListener<String, HazelcastJsonValue>, | ||
EntryEvictedListener<String, HazelcastJsonValue> { | ||
|
||
private final ApplicationEventPublisher applicationEventPublisher; | ||
|
||
public JsonCacheServiceEntryListener(ApplicationEventPublisher applicationEventPublisher) { | ||
this.applicationEventPublisher = applicationEventPublisher; | ||
} | ||
|
||
@Override | ||
public void entryAdded(EntryEvent<String, HazelcastJsonValue> entryEvent) { | ||
applicationEventPublisher.publishEvent(new JsonCacheServiceEvent(entryEvent)); | ||
} | ||
|
||
@Override | ||
public void entryEvicted(EntryEvent<String, HazelcastJsonValue> entryEvent) { | ||
applicationEventPublisher.publishEvent(new JsonCacheServiceEvent(entryEvent)); | ||
} | ||
|
||
@Override | ||
public void entryRemoved(EntryEvent<String, HazelcastJsonValue> entryEvent) { | ||
applicationEventPublisher.publishEvent(new JsonCacheServiceEvent(entryEvent)); | ||
} | ||
|
||
@Override | ||
public void entryUpdated(EntryEvent<String, HazelcastJsonValue> entryEvent) { | ||
applicationEventPublisher.publishEvent(new JsonCacheServiceEvent(entryEvent)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ore/src/main/java/de/telekom/eni/pandora/horizon/cache/service/JsonCacheServiceEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package de.telekom.eni.pandora.horizon.cache.service; | ||
|
||
import com.hazelcast.core.EntryEvent; | ||
import com.hazelcast.core.HazelcastJsonValue; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
public class JsonCacheServiceEvent { | ||
|
||
private EntryEvent<String, HazelcastJsonValue> entryEvent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters