diff --git a/pom.xml b/pom.xml index bf36dc4..b7c0998 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.sipios spring-data-event - 0.1.0 + 0.2.0 com.sipios:spring-data-event A Java library offering the @DataEventEntity annotation for publishing database entity changes to a Kafka queue, enabling straightforward event-driven architectures by automating event publication upon entity persistence. diff --git a/src/main/java/com/sipios/spring/data/event/listener/DataEventListener.java b/src/main/java/com/sipios/spring/data/event/listener/DataEventListener.java index c3117e8..a9eb3cc 100644 --- a/src/main/java/com/sipios/spring/data/event/listener/DataEventListener.java +++ b/src/main/java/com/sipios/spring/data/event/listener/DataEventListener.java @@ -11,7 +11,7 @@ import org.springframework.stereotype.Component; @Component -public class DataEventListener implements PostInsertEventListener, PostUpdateEventListener, PostDeleteEventListener { +public class DataEventListener implements PostCommitInsertEventListener, PostCommitUpdateEventListener, PostCommitDeleteEventListener { private final DataEventBroadcaster dataEventBroadcaster; private final EntityManagerFactory entityManagerFactory; @@ -20,9 +20,9 @@ public class DataEventListener implements PostInsertEventListener, PostUpdateEve private void init() { SessionFactoryImpl sessionFactory = entityManagerFactory.unwrap(SessionFactoryImpl.class); EventListenerRegistry registry = sessionFactory.getServiceRegistry().getService(EventListenerRegistry.class); - registry.getEventListenerGroup(EventType.POST_INSERT).appendListener(this); - registry.getEventListenerGroup(EventType.POST_UPDATE).appendListener(this); - registry.getEventListenerGroup(EventType.POST_DELETE).appendListener(this); + registry.getEventListenerGroup(EventType.POST_COMMIT_INSERT).appendListener(this); + registry.getEventListenerGroup(EventType.POST_COMMIT_UPDATE).appendListener(this); + registry.getEventListenerGroup(EventType.POST_COMMIT_DELETE).appendListener(this); } public DataEventListener(DataEventBroadcaster dataEventBroadcaster, EntityManagerFactory entityManagerFactory) { @@ -58,4 +58,17 @@ public void onPostUpdate(PostUpdateEvent event) { public boolean requiresPostCommitHandling(EntityPersister persister) { return true; } + + @Override + public void onPostInsertCommitFailed(PostInsertEvent event) { + } + + @Override + public void onPostDeleteCommitFailed(PostDeleteEvent event) { + + } + + @Override + public void onPostUpdateCommitFailed(PostUpdateEvent event) { + } }