Skip to content

Commit

Permalink
Revert "RC-40: Register listeners via @handler annotation"
Browse files Browse the repository at this point in the history
This reverts commit 8a1efcc.
  • Loading branch information
mogoodrich committed Jan 2, 2025
1 parent 6ec438e commit de1bad9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;

Expand Down Expand Up @@ -46,6 +47,14 @@ 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;
Expand All @@ -22,7 +21,6 @@
* 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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;
Expand All @@ -18,7 +17,6 @@
/**
* 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);
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/resources/moduleApplicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
</bean>

<bean id="registrationcore.patientCreatedListener"
class="org.openmrs.module.registrationcore.api.impl.PatientCreatedListener">
class="org.openmrs.module.registrationcore.api.impl.PatientCreatedListener" init-method="init">
<property name="coreProperties" ref="registrationcore.coreProperties"/>
<property name="patientService" ref="patientService"/>
<property name="mpiProperties" ref="registrationcore.mpiProperties"/>
<property name="identifierBuilder" ref="registrationcore.identifierBuilder"/>
</bean>

<bean id="registrationcore.patientUpdatedListener"
class="org.openmrs.module.registrationcore.api.impl.PatientUpdatedListener">
class="org.openmrs.module.registrationcore.api.impl.PatientUpdatedListener" init-method="init">
<property name="coreProperties" ref="registrationcore.coreProperties"/>
<property name="patientService" ref="patientService"/>
</bean>
Expand Down

0 comments on commit de1bad9

Please sign in to comment.