diff --git a/kudos-services/src/main/java/io/meeds/kudos/listener/GamificationIntegrationListener.java b/kudos-services/src/main/java/io/meeds/kudos/listener/GamificationIntegrationListener.java index cf799dbe0..5bf07b9c4 100644 --- a/kudos-services/src/main/java/io/meeds/kudos/listener/GamificationIntegrationListener.java +++ b/kudos-services/src/main/java/io/meeds/kudos/listener/GamificationIntegrationListener.java @@ -33,8 +33,6 @@ import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; -import org.exoplatform.commons.api.persistence.ExoTransactional; -import org.exoplatform.services.listener.Asynchronous; import org.exoplatform.services.listener.Event; import org.exoplatform.services.listener.Listener; import org.exoplatform.services.listener.ListenerService; @@ -47,7 +45,6 @@ /** * A listener to add comment or activity */ -@Asynchronous @Component @Profile("gamification") public class GamificationIntegrationListener extends Listener { @@ -61,9 +58,8 @@ public void init() { listenerService.addListener("kudos.cancel.activity", this); } - @ExoTransactional @Override - public void onEvent(Event event) throws Exception { + public void onEvent(Event event) { Kudos kudos = event.getData(); String eventName = event.getEventName(); @@ -71,7 +67,7 @@ public void onEvent(Event event) throws Exception { saveRecieveKudosAchievement(kudos, eventName); } - private void saveSendKudosAchievement(Kudos kudos, String eventName) throws Exception { + private void saveSendKudosAchievement(Kudos kudos, String eventName) { Map gam = buildGamificationEventDetails(GAMIFICATION_SEND_KUDOS_EVENT_NAME, kudos.getSenderId(), kudos.getReceiverId(), @@ -79,7 +75,7 @@ private void saveSendKudosAchievement(Kudos kudos, String eventName) throws Exce listenerService.broadcast(getGamificationEventName(eventName), gam, String.valueOf(kudos.getTechnicalId())); } - private void saveRecieveKudosAchievement(Kudos kudos, String eventName) throws Exception { + private void saveRecieveKudosAchievement(Kudos kudos, String eventName) { Map gam = buildGamificationEventDetails(GAMIFICATION_RECEIVE_KUDOS_EVENT_NAME, kudos.getReceiverId(), kudos.getSenderId(), diff --git a/kudos-services/src/main/java/io/meeds/kudos/listener/KudosCanceledListener.java b/kudos-services/src/main/java/io/meeds/kudos/listener/KudosCanceledListener.java index cdee060a4..55017448c 100644 --- a/kudos-services/src/main/java/io/meeds/kudos/listener/KudosCanceledListener.java +++ b/kudos-services/src/main/java/io/meeds/kudos/listener/KudosCanceledListener.java @@ -20,6 +20,8 @@ package io.meeds.kudos.listener; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import org.exoplatform.services.listener.Event; @@ -33,6 +35,7 @@ import jakarta.annotation.PostConstruct; @Component +@Order(Ordered.LOWEST_PRECEDENCE) public class KudosCanceledListener extends Listener { @Autowired @@ -47,7 +50,7 @@ public void init() { } @Override - public void onEvent(Event event) throws Exception { + public void onEvent(Event event) { Kudos kudos = event.getData(); if (kudos != null && kudos.getActivityId() > 0) { activityManager.deleteActivity(String.valueOf(kudos.getActivityId()));