diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientActionListener.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientActionListener.java index 50d2802c..528b88cc 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientActionListener.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientActionListener.java @@ -12,7 +12,6 @@ import org.openmrs.api.APIException; import org.openmrs.api.PatientService; import org.openmrs.api.context.Daemon; -import org.openmrs.event.Event; import org.openmrs.event.SubscribableEventListener; import org.openmrs.module.DaemonToken; @@ -47,14 +46,6 @@ public void setDaemonToken(DaemonToken daemonToken) { this.daemonToken = daemonToken; } - /** - * Subscribes for Class - Patient and specified Actions event. - */ - public void init() { - Event event = new Event(); - event.setSubscription(this); - } - /** * Performs action based on messaged received. * diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientCreatedListener.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientCreatedListener.java index 13b23ca4..1cae9d37 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientCreatedListener.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientCreatedListener.java @@ -6,6 +6,7 @@ import org.openmrs.Patient; import org.openmrs.PatientIdentifier; import org.openmrs.PatientIdentifierType; +import org.openmrs.annotation.Handler; import org.openmrs.event.Event; import org.openmrs.module.registrationcore.api.errorhandling.ErrorHandlingService; import org.openmrs.module.registrationcore.api.errorhandling.PixErrorHandlingService; @@ -21,6 +22,7 @@ * This class listens for patient CREATED events. If MPI is enabled, it exports patient to MPI, and * updates the local patient with the new patient identifier generated by the MPI. */ +@Handler public class PatientCreatedListener extends PatientActionListener { private static final Logger LOGGER = LoggerFactory.getLogger(PatientCreatedListener.class); diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientUpdatedListener.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientUpdatedListener.java index d375c678..93137a42 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientUpdatedListener.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/PatientUpdatedListener.java @@ -2,6 +2,7 @@ import org.apache.commons.lang.exception.ExceptionUtils; import org.openmrs.Patient; +import org.openmrs.annotation.Handler; import org.openmrs.event.Event; import javax.jms.Message; @@ -17,6 +18,7 @@ /** * This class listens for patient UPDATED events. If MPI is enabled it updates patient in MPI. */ +@Handler public class PatientUpdatedListener extends PatientActionListener { private static final Logger LOGGER = LoggerFactory.getLogger(PatientUpdatedListener.class); diff --git a/api/src/main/resources/moduleApplicationContext.xml b/api/src/main/resources/moduleApplicationContext.xml index 590b2f24..a6df9b76 100644 --- a/api/src/main/resources/moduleApplicationContext.xml +++ b/api/src/main/resources/moduleApplicationContext.xml @@ -35,7 +35,7 @@ + class="org.openmrs.module.registrationcore.api.impl.PatientCreatedListener"> @@ -43,7 +43,7 @@ + class="org.openmrs.module.registrationcore.api.impl.PatientUpdatedListener">