Permalink
Browse files

almost got the entire distributed via jms sample done

Signed-off-by: Christian Posta <christian.posta@gmail.com>
  • Loading branch information...
1 parent d80906f commit 87a980812c2307c41922dd71f362eaf1dff529fe @christian-posta committed Jan 31, 2012
@@ -0,0 +1,28 @@
+package org.springframework.integration.samples.cafe.xml;
+
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.samples.cafe.Cafe;
+import org.springframework.integration.samples.cafe.DrinkType;
+import org.springframework.integration.samples.cafe.Order;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ceposta
+ * Date: 1/27/12
+ * Time: 7:57 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CafeDemoAppBaristaColdActiveMQ {
+
+
+ public static void main(String[] args) throws InterruptedException, IOException {
+ AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
+ "/META-INF/spring/integration/activemq/cafeDemo-amq-baristaCold-xml.xml");
+
+ System.in.read();
+ context.close();
+ }
+}
@@ -0,0 +1,25 @@
+package org.springframework.integration.samples.cafe.xml;
+
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ceposta
+ * Date: 1/27/12
+ * Time: 7:57 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CafeDemoAppBaristaHotActiveMQ {
+
+
+ public static void main(String[] args) throws InterruptedException, IOException {
+ AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
+ "/META-INF/spring/integration/activemq/cafeDemo-amq-baristaHot-xml.xml");
+
+ System.in.read();
+ context.close();
+ }
+}
@@ -0,0 +1,25 @@
+package org.springframework.integration.samples.cafe.xml;
+
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ceposta
+ * Date: 1/27/12
+ * Time: 7:57 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CafeDemoAppOperationsActiveMQ {
+
+
+ public static void main(String[] args) throws InterruptedException, IOException {
+ AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
+ "/META-INF/spring/integration/activemq/cafeDemo-amq-operations.xml");
+
+ System.in.read();
+ context.close();
+ }
+}
@@ -8,7 +8,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.1.xsd
- http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.4.2.xsd">
+ http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
+ http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.4.2.xsd">
<!-- Set up a live broker with a transport connector at port 61616 (default amq port)
We imported the ActiveMQ schema so we can use the schema support. When this application shuts down,
@@ -2,8 +2,12 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
+ xmlns:stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
+ http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
+ http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
<!--Create a reference to the queue on the broker that has the new orders. Note, just because
we create a new bean with the cafe.orders destination name does not mean we actually create a new
@@ -17,7 +21,7 @@
<int:channel id="jsonNewOrders"/>
<int:chain input-channel="jsonNewOrders">
- <int:json-to-object-transformer />
+ <int:json-to-object-transformer type="org.springframework.integration.samples.cafe.Order"/>
<int:splitter expression="payload.items" apply-sequence="true" />
<int:header-enricher>
<int:header name="ICED" expression="payload.isIced()" />
@@ -39,7 +43,9 @@
<int-jms:outbound-gateway id="coldDrinksBarista"
request-channel="coldDrinks"
reply-channel="preparedJsonDrinks"
- reply-destination="coldDrinksQueue"/>
+ request-destination="coldDrinksQueue"
+ receive-timeout="30000"
+ reply-timeout="30000"/>
<int:channel id="hotDrinks">
@@ -51,9 +57,23 @@
<int-jms:outbound-gateway id="hotDrinksBarista"
request-channel="hotDrinks"
reply-channel="preparedJsonDrinks"
- request-destination="hotDrinksQueue"/>
+ request-destination="hotDrinksQueue"
+ receive-timeout="30000"
+ reply-timeout="30000"/>
<int:channel id="preparedJsonDrinks"/>
+ <int:chain input-channel="preparedJsonDrinks" output-channel="deliverDrinks">
+ <int:aggregator method="prepareDelivery">
+ <bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
+ </int:aggregator>
+ <int:header-enricher>
+ <int:header name="NUMBER" expression="payload.getOrderNumber()"/>
+ </int:header-enricher>
+ </int:chain>
+
+ <int:channel id="deliverDrinks"/>
+ <stream:stdout-channel-adapter id="deliveriesStdout" channel="deliverDrinks"/>
+
</beans>

0 comments on commit 87a9808

Please sign in to comment.