Przeglądaj źródła

Wrapping remote booking facade with Hibernate & RMI proxies, added more JMS queues and topics.

peter_backlund 17 lat temu
rodzic
commit
0de52b5490

+ 11
- 11
dddsample/src/main/resources/context-messaging-jms.xml Wyświetl plik

@@ -5,12 +5,11 @@
5 5
        xmlns:amq="http://activemq.apache.org/schema/core"
6 6
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 7
        xsi:schemaLocation="
8
-        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd
8
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
9 9
         http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
10
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
10
+        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
11 11
 
12
-
13
-  <amq:connectionFactory id="jmsConnectionFactory" brokerURL="vm://localhost?broker.persistent=false"/>
12
+  <amq:connectionFactory id="jmsConnectionFactory" brokerURL="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
14 13
 
15 14
   <amq:topic id="cargoHandledTopic" name="CargoHandledTopic" physicalName="CargoHandledTopic"/>
16 15
   <amq:topic id="misdirectedCargoTopic" name="MisdirectedCargoTopic" physicalName="MisdirectedCargoTopic"/>
@@ -19,19 +18,18 @@
19 18
   <amq:queue id="rejectedRegistrationAttemptsQueue" name="RejectedRegistrationAttemptsQueue" physicalName="RejectedRegistrationAttemptsQueue"/>
20 19
 
21 20
   <jms:listener-container connection-factory="jmsConnectionFactory">
22
-    <jms:listener destination="cargoHandledTopic" ref="cargoHandledConsumer" />
23
-    <!-- TODO subscribers for these topics/queues
24
-    <jms:listener destination="misdirectedCargoTopic" ref="TODO"/>
25
-    <jms:listener destination="deliveredCargoTopic" ref="TODO"/>
26
-    -->
27
-    <jms:listener destination="handlingEventRegistrationAttemptQueue" ref="handlingEventRegistrationAttemptConsumer" />
21
+    <jms:listener destination="CargoHandledTopic" ref="cargoHandledConsumer" />
22
+    <jms:listener destination="HandlingEventRegistrationAttemptQueue" ref="handlingEventRegistrationAttemptConsumer" />
23
+    <jms:listener destination="MisdirectedCargoTopic" ref="simpleLoggingConsumer"/>
24
+    <jms:listener destination="DeliveredCargoTopic" ref="simpleLoggingConsumer"/>
25
+    <jms:listener destination="RejectedRegistrationAttemptsQueue" ref="simpleLoggingConsumer"/>
28 26
   </jms:listener-container>
29 27
 
30 28
   <bean id="jmsOperations" class="org.springframework.jms.core.JmsTemplate">
31 29
     <property name="connectionFactory" ref="jmsConnectionFactory"/>
32 30
   </bean>
33 31
 
34
-  <bean id="systemEvents" class="se.citerus.dddsample.infrastructure.messaging.jms.JmsSystemEventsImpl">
32
+  <bean id="applicationEvents" class="se.citerus.dddsample.infrastructure.messaging.jms.JmsApplicationEventsImpl">
35 33
     <property name="jmsOperations" ref="jmsOperations"/>
36 34
     <property name="cargoHandledTopic" ref="cargoHandledTopic"/>
37 35
     <property name="misdirectedCargoTopic" ref="misdirectedCargoTopic"/>
@@ -47,5 +45,7 @@
47 45
   <bean id="handlingEventRegistrationAttemptConsumer" class="se.citerus.dddsample.infrastructure.messaging.jms.HandlingEventRegistrationAttemptConsumer">
48 46
     <property name="handlingEventService" ref="handlingEventService"/>
49 47
   </bean>
48
+
49
+  <bean id="simpleLoggingConsumer" class="se.citerus.dddsample.infrastructure.messaging.jms.SimpleLoggingConsumer"/>
50 50
   
51 51
 </beans>

+ 25
- 8
dddsample/src/main/resources/context-remote.xml Wyświetl plik

@@ -15,27 +15,24 @@
15 15
   <jaxws:endpoint id="jax-ws.http" implementor="#handlingReportService" address="/ws/RegisterEvent"/>
16 16
 
17 17
   <bean id="handlingReportService" class="se.citerus.dddsample.interfaces.handling.ws.impl.HandlingReportServiceImpl">
18
-    <property name="registrationParser" ref="registrationParser"/>
18
+    <property name="applicationEvents" ref="applicationEvents"/>
19 19
   </bean>
20 20
 
21 21
   <!-- File upload directory scanner -->
22 22
 
23 23
   <bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
24 24
     <property name="period" value="5000"/>
25
-    <property name="delay" value="3000"/>
25
+    <property name="delay" value="5000"/>
26 26
     <property name="timerTask" ref="uploadDirectoryScanner"/>
27 27
   </bean>
28 28
 
29 29
   <bean id="uploadDirectoryScanner" class="se.citerus.dddsample.interfaces.handling.file.UploadDirectoryScanner">
30 30
     <property name="uploadDirectory" value="/tmp/upload"/>
31 31
     <property name="parseFailureDirectory" value="/tmp/failed"/>
32
-    <property name="registrationParser" ref="registrationParser"/>
33
-  </bean>
34
-
35
-  <bean id="registrationParser" class="se.citerus.dddsample.interfaces.handling.RegistrationParser">
36
-    <property name="systemEvents" ref="systemEvents"/>
32
+    <property name="applicationEvents" ref="applicationEvents"/>
37 33
   </bean>
38 34
 
35
+  <bean id="handlingReportConsumptionSupport" class="se.citerus.dddsample.interfaces.handling.HandlingReportParser"/>
39 36
 
40 37
   <bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
41 38
     <property name="scheduledTimerTasks">
@@ -45,8 +42,28 @@
45 42
     </property>
46 43
   </bean>
47 44
   
48
-  <!-- RMI exposed booking service facade -->
45
+  <!-- RMI exposed booking service facade, which operates in an open Hibernate session -->
46
+
47
+  <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
48
+    <property name="sessionFactory" ref="sessionFactory"/>
49
+  </bean>
49 50
 
51
+  <bean id="bookingServiceFacade" class="org.springframework.aop.framework.ProxyFactoryBean">
52
+    <property name="target" ref="bookingServiceFacadeTarget"/>
53
+    <property name="interceptorNames">
54
+      <list>
55
+        <value>hibernateInterceptor</value>
56
+      </list>
57
+    </property>
58
+  </bean>
59
+
60
+  <bean id="bookingServiceFacadeTarget" class="se.citerus.dddsample.interfaces.booking.facade.BookingServiceFacadeImpl">
61
+    <property name="bookingService" ref="bookingService"/>
62
+    <property name="cargoRepository" ref="cargoRepository"/>
63
+    <property name="locationRepository" ref="locationRepository"/>
64
+    <property name="voyageRepository" ref="voyageRepository"/>
65
+  </bean>
66
+  
50 67
   <bean id="rmiBookingServiceFacade" class="org.springframework.remoting.rmi.RmiServiceExporter">
51 68
     <property name="serviceInterface" value="se.citerus.dddsample.interfaces.booking.facade.BookingServiceFacade"/>
52 69
     <property name="service" ref="bookingServiceFacade"/>

+ 2
- 9
dddsample/src/main/resources/context-service.xml Wyświetl plik

@@ -15,13 +15,13 @@
15 15
 
16 16
   <bean id="trackingService" class="se.citerus.dddsample.application.impl.TrackingServiceImpl">
17 17
     <constructor-arg ref="cargoRepository"/>
18
-    <constructor-arg ref="systemEvents"/>
18
+    <constructor-arg ref="applicationEvents"/>
19 19
   </bean>
20 20
 
21 21
   <bean id="handlingEventService" class="se.citerus.dddsample.application.impl.HandlingEventServiceImpl">
22 22
     <constructor-arg ref="handlingEventRepository"/>
23 23
     <constructor-arg ref="handlingEventFactory"/>
24
-    <constructor-arg ref="systemEvents"/>
24
+    <constructor-arg ref="applicationEvents"/>
25 25
   </bean>
26 26
 
27 27
   <bean id="handlingEventFactory" class="se.citerus.dddsample.domain.model.handling.HandlingEventFactory">
@@ -38,11 +38,4 @@
38 38
     <property name="graphTraversalService" ref="graphTraversalService"/>
39 39
   </bean>
40 40
 
41
-  <bean id="bookingServiceFacade" class="se.citerus.dddsample.interfaces.booking.facade.BookingServiceFacadeImpl">
42
-    <property name="bookingService" ref="bookingService"/>
43
-    <property name="cargoRepository" ref="cargoRepository"/>
44
-    <property name="locationRepository" ref="locationRepository"/>
45
-    <property name="voyageRepository" ref="voyageRepository"/>
46
-  </bean>
47
-  
48 41
 </beans>