|
|
@@ -1,38 +0,0 @@
|
|
1
|
|
-package se.citerus.dddsample.application.messaging;
|
|
2
|
|
-
|
|
3
|
|
-import org.apache.commons.logging.Log;
|
|
4
|
|
-import org.apache.commons.logging.LogFactory;
|
|
5
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
6
|
|
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
|
|
7
|
|
-import se.citerus.dddsample.domain.service.TrackingService;
|
|
8
|
|
-
|
|
9
|
|
-import javax.jms.JMSException;
|
|
10
|
|
-import javax.jms.Message;
|
|
11
|
|
-import javax.jms.MessageListener;
|
|
12
|
|
-
|
|
13
|
|
-/**
|
|
14
|
|
- * Consumes JMS messages and delegates notification of misdirected
|
|
15
|
|
- * cargo to the cargo service.
|
|
16
|
|
- */
|
|
17
|
|
-public class HandlingEventMessageDelegate implements MessageListener {
|
|
18
|
|
-
|
|
19
|
|
- private TrackingService trackingService;
|
|
20
|
|
- private final Log logger = LogFactory.getLog(getClass());
|
|
21
|
|
-
|
|
22
|
|
- @Transactional(readOnly = true)
|
|
23
|
|
- public void onMessage(final Message message) {
|
|
24
|
|
- if (logger.isDebugEnabled()) {
|
|
25
|
|
- logger.debug("Received message " + message);
|
|
26
|
|
- }
|
|
27
|
|
- try {
|
|
28
|
|
- String tidString = message.getStringProperty(JmsDomainEventNotifierImpl.TRACKING_ID_KEY);
|
|
29
|
|
- trackingService.inspectCargo(new TrackingId(tidString));
|
|
30
|
|
- } catch (JMSException e) {
|
|
31
|
|
- logger.error(e, e);
|
|
32
|
|
- }
|
|
33
|
|
- }
|
|
34
|
|
-
|
|
35
|
|
- public void setTrackingService(TrackingService trackingService) {
|
|
36
|
|
- this.trackingService = trackingService;
|
|
37
|
|
- }
|
|
38
|
|
-}
|