peter_backlund 18 лет назад
Родитель
Сommit
6188e8f0d1

+ 0
- 38
dddsample/src/main/java/se/citerus/dddsample/application/messaging/HandlingEventMessageDelegate.java Просмотреть файл

@@ -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
-}

+ 0
- 21
dddsample/src/main/java/se/citerus/dddsample/application/ws/InvalidEventTypeException.java Просмотреть файл

@@ -1,21 +0,0 @@
1
-package se.citerus.dddsample.application.ws;
2
-
3
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
4
-
5
-import java.util.Arrays;
6
-
7
-/**
8
- * Thrown when trying to register an event with an invalid type.
9
- *
10
- */
11
-public class InvalidEventTypeException extends Throwable {
12
-  private String eventType;
13
-
14
-  public InvalidEventTypeException(String eventType) {
15
-    this.eventType = eventType;
16
-  }
17
-
18
-  public String getMessage() {
19
-    return "Invalid event type: " + eventType + ". Valid types are: " + Arrays.deepToString(HandlingEvent.Type.values());
20
-  }
21
-}