|
|
@@ -1,5 +1,7 @@
|
|
1
|
1
|
package se.citerus.dddsample.infrastructure.messaging.stub;
|
|
2
|
2
|
|
|
|
3
|
+import org.apache.commons.logging.Log;
|
|
|
4
|
+import org.apache.commons.logging.LogFactory;
|
|
3
|
5
|
import se.citerus.dddsample.application.ApplicationEvents;
|
|
4
|
6
|
import se.citerus.dddsample.application.CargoInspectionService;
|
|
5
|
7
|
import se.citerus.dddsample.domain.model.cargo.Cargo;
|
|
|
@@ -9,6 +11,7 @@ import se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt
|
|
9
|
11
|
public class SynchronousApplicationEventsStub implements ApplicationEvents {
|
|
10
|
12
|
|
|
11
|
13
|
CargoInspectionService cargoInspectionService;
|
|
|
14
|
+ private final Log logger = LogFactory.getLog(getClass());
|
|
12
|
15
|
|
|
13
|
16
|
public void setCargoInspectionService(CargoInspectionService cargoInspectionService) {
|
|
14
|
17
|
this.cargoInspectionService = cargoInspectionService;
|
|
|
@@ -16,22 +19,22 @@ public class SynchronousApplicationEventsStub implements ApplicationEvents {
|
|
16
|
19
|
|
|
17
|
20
|
@Override
|
|
18
|
21
|
public void cargoWasHandled(HandlingEvent event) {
|
|
19
|
|
- System.out.println("EVENT: cargo was handled: " + event);
|
|
|
22
|
+ logger.info("EVENT: cargo was handled: " + event);
|
|
20
|
23
|
cargoInspectionService.inspectCargo(event.cargo().trackingId());
|
|
21
|
24
|
}
|
|
22
|
25
|
|
|
23
|
26
|
@Override
|
|
24
|
27
|
public void cargoWasMisdirected(Cargo cargo) {
|
|
25
|
|
- System.out.println("EVENT: cargo was misdirected");
|
|
|
28
|
+ logger.info("EVENT: cargo was misdirected");
|
|
26
|
29
|
}
|
|
27
|
30
|
|
|
28
|
31
|
@Override
|
|
29
|
32
|
public void cargoHasArrived(Cargo cargo) {
|
|
30
|
|
- System.out.println("EVENT: cargo has arrived: " + cargo.trackingId().idString());
|
|
|
33
|
+ logger.info("EVENT: cargo has arrived: " + cargo.trackingId().idString());
|
|
31
|
34
|
}
|
|
32
|
35
|
|
|
33
|
36
|
@Override
|
|
34
|
37
|
public void receivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt) {
|
|
35
|
|
- System.out.println("EVENT: received handling event registration attempt");
|
|
|
38
|
+ logger.info("EVENT: received handling event registration attempt");
|
|
36
|
39
|
}
|
|
37
|
40
|
}
|