Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 12 commits
  • 20 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 01, 2012
@christian-posta added idea folder to gitignore
Signed-off-by: Christian Posta <christian.posta@gmail.com>
bce4753
@christian-posta moved log4j here since that's where the code is
Signed-off-by: Christian Posta <christian.posta@gmail.com>
040edf9
@christian-posta made the objects serializable for now..
Signed-off-by: Christian Posta <christian.posta@gmail.com>
c7db24c
@christian-posta added an embedded activemq. can now prove the persistence of the amq …
…works

Signed-off-by: Christian Posta <christian.posta@gmail.com>
c8c3acd
@christian-posta added activemq data to ignore list
Signed-off-by: Christian Posta <christian.posta@gmail.com>
aeb87db
@christian-posta converted all of the in-memory SI channels to JMS-backed channels
Signed-off-by: Christian Posta <christian.posta@gmail.com>
23a0a8f
@christian-posta Added comments to the SI config files for ActiveMQ
Signed-off-by: Christian Posta <christian.posta@gmail.com>
b8083ee
@christian-posta Clean up config file of unused namespace declarations
Signed-off-by: Christian Posta <christian.posta@gmail.com>
bf979fb
@christian-posta Forgot to make the Java objects serializable. Note, you can convert t…
…o json or some other format if you don't want to serialize the java objects over the broker

Signed-off-by: Christian Posta <christian.posta@gmail.com>
4690113
@christian-posta In the middle of creating the distributed ActiveMQ/JMS SI routing sample
Signed-off-by: Christian Posta <christian.posta@gmail.com>
d80906f
@christian-posta almost got the entire distributed via jms sample done
Signed-off-by: Christian Posta <christian.posta@gmail.com>
87a9808
@christian-posta Fixed bug with drinks not being converted back to a java type
Signed-off-by: Christian Posta <christian.posta@gmail.com>
f99181a
Showing with 442 additions and 6 deletions.
  1. +2 −0 .gitignore
  2. +17 −0 applications/cafe/pom.xml
  3. +2 −1 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Delivery.java
  4. +3 −1 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Drink.java
  5. +3 −1 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/DrinkType.java
  6. +2 −1 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Order.java
  7. +3 −1 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/OrderItem.java
  8. +43 −0 ...rc/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoActiveMQBackedChannels.java
  9. +43 −0 ...ions/cafe/src/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoAppActiveMQ.java
  10. +28 −0 ...rc/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoAppBaristaColdActiveMQ.java
  11. +25 −0 ...src/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoAppBaristaHotActiveMQ.java
  12. +25 −0 ...src/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoAppOperationsActiveMQ.java
  13. +22 −0 ...ons/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-baristaCold-xml.xml
  14. +22 −0 ...ions/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-baristaHot-xml.xml
  15. +20 −0 applications/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml
  16. +68 −0 ...ications/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-jms-backed.xml
  17. +80 −0 ...ications/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-operations.xml
  18. +33 −0 applications/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-xml.xml
  19. +1 −1 applications/cafe/src/main/resources/META-INF/spring/integration/amqp/cafeDemo-amqp-xml.xml
  20. 0 applications/cafe/src/{test → main}/resources/log4j.xml
View
2 .gitignore
@@ -11,3 +11,5 @@ log.roo
*.ipr
*.iws
derby.log
+.idea
+activemq-data
View
17 applications/cafe/pom.xml
@@ -12,9 +12,21 @@
<spring.core.version>3.1.0.RELEASE</spring.core.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
+ <activemq.version>5.4.3</activemq.version>
</properties>
<dependencies>
<dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>${activemq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <version>3.9</version>
+ </dependency>
+
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.core.version}</version>
@@ -29,6 +41,11 @@
<artifactId>spring-integration-amqp</artifactId>
<version>${spring.integration.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.integration</groupId>
+ <artifactId>spring-integration-jms</artifactId>
+ <version>${spring.integration.version}</version>
+ </dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
View
3 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Delivery.java
@@ -16,13 +16,14 @@
package org.springframework.integration.samples.cafe;
+import java.io.Serializable;
import java.util.List;
/**
* @author Marius Bogoevici
* @author Tom McCuch
*/
-public class Delivery {
+public class Delivery implements Serializable{
private static final String SEPARATOR = "-----------------------";
View
4 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Drink.java
@@ -16,11 +16,13 @@
package org.springframework.integration.samples.cafe;
+import java.io.Serializable;
+
/**
* @author Marius Bogoevici
* @author Tom McCuch
*/
-public class Drink {
+public class Drink implements Serializable{
private boolean iced;
View
4 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/DrinkType.java
@@ -16,10 +16,12 @@
package org.springframework.integration.samples.cafe;
+import java.io.Serializable;
+
/**
* @author Mark Fisher
*/
-public enum DrinkType {
+public enum DrinkType implements Serializable{
ESPRESSO,
LATTE,
View
3 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/Order.java
@@ -16,6 +16,7 @@
package org.springframework.integration.samples.cafe;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +25,7 @@
* @author Marius Bogoevici
* @author Tom McCuch
*/
-public class Order {
+public class Order implements Serializable{
private List<OrderItem> orderItems = new ArrayList<OrderItem>();
View
4 applications/cafe/src/main/java/org/springframework/integration/samples/cafe/OrderItem.java
@@ -16,12 +16,14 @@
package org.springframework.integration.samples.cafe;
+import java.io.Serializable;
+
/**
* @author Mark Fisher
* @author Marius Bogoevici
* @author Tom McCuch
*/
-public class OrderItem {
+public class OrderItem implements Serializable {
private DrinkType type;
View
43 ...java/org/springframework/integration/samples/cafe/xml/CafeDemoActiveMQBackedChannels.java
@@ -0,0 +1,43 @@
+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 CafeDemoActiveMQBackedChannels {
+
+ /**
+ * place some orders
+ * @param context spring context
+ * @param count the number of standard orders
+ */
+ public static void order(AbstractApplicationContext context, int count){
+ Cafe cafe = (Cafe) context.getBean("cafe");
+ for (int i = 1; i <= count; i++) {
+ Order order = new Order(i);
+ order.addItem(DrinkType.LATTE, 2, false);
+ order.addItem(DrinkType.MOCHA, 3, true);
+ cafe.placeOrder(order);
+ }
+ }
+
+ 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-jms-backed.xml");
+ order(context, 25);
+
+ System.in.read();
+ context.close();
+ }
+}
View
43 ...e/src/main/java/org/springframework/integration/samples/cafe/xml/CafeDemoAppActiveMQ.java
@@ -0,0 +1,43 @@
+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 CafeDemoAppActiveMQ {
+
+ /**
+ * place some orders
+ * @param context spring context
+ * @param count the number of standard orders
+ */
+ public static void order(AbstractApplicationContext context, int count){
+ Cafe cafe = (Cafe) context.getBean("cafe");
+ for (int i = 1; i <= count; i++) {
+ Order order = new Order(i);
+ order.addItem(DrinkType.LATTE, 2, false);
+ order.addItem(DrinkType.MOCHA, 3, true);
+ cafe.placeOrder(order);
+ }
+ }
+
+ 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-xml.xml");
+ order(context, 25);
+
+ System.in.read();
+ context.close();
+ }
+}
View
28 ...java/org/springframework/integration/samples/cafe/xml/CafeDemoAppBaristaColdActiveMQ.java
@@ -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();
+ }
+}
View
25 .../java/org/springframework/integration/samples/cafe/xml/CafeDemoAppBaristaHotActiveMQ.java
@@ -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();
+ }
+}
View
25 .../java/org/springframework/integration/samples/cafe/xml/CafeDemoAppOperationsActiveMQ.java
@@ -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();
+ }
+}
View
22 .../src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-baristaCold-xml.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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: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">
+
+
+ <bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.drinks.cold"/>
+ </bean>
+ <int-jms:inbound-gateway request-channel="coldJsonDrinks" request-destination="coldDrinksQueue"/>
+ <int:channel id="coldJsonDrinks" />
+
+ <int:chain input-channel="coldJsonDrinks">
+ <int:json-to-object-transformer type="org.springframework.integration.samples.cafe.OrderItem"/>
+ <int:service-activator method="prepareColdDrink">
+ <bean class="org.springframework.integration.samples.cafe.xml.Barista" />
+ </int:service-activator>
+ <int:object-to-json-transformer />
+ </int:chain>
+</beans>
View
22 ...e/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-baristaHot-xml.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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: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">
+
+
+ <bean id="hotDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.drinks.hot"/>
+ </bean>
+ <int-jms:inbound-gateway request-channel="hotJsonDrinks" request-destination="hotDrinksQueue"/>
+ <int:channel id="hotJsonDrinks" />
+
+ <int:chain input-channel="hotJsonDrinks">
+ <int:json-to-object-transformer type="org.springframework.integration.samples.cafe.OrderItem"/>
+ <int:service-activator method="prepareHotDrink">
+ <bean class="org.springframework.integration.samples.cafe.xml.Barista" />
+ </int:service-activator>
+ <int:object-to-json-transformer />
+ </int:chain>
+</beans>
View
20 ...ions/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
+
+
+ <!-- Set up the connection factory. You must name the bean "connectionFactory" for the JMS-backed
+ channels to automatically find it. Otherwise, you must specify the connection when you declare the
+ channel -->
+ <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
+ <property name="targetConnectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1"/>
+ </bean>
+ </property>
+ <property name="sessionCacheSize" value="10"/>
+ <property name="cacheProducers" value="false"/>
+ </bean>
+
+</beans>
View
68 .../cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-jms-backed.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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"
+ xmlns:amq="http://activemq.apache.org/schema/core"
+ 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">
+
+ <!-- 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,
+ so does the broker. You can omit the embedded declaration here and set up the broker stand alone and
+ use the standard ActiveMQ HighAvailability mechanism. You can also use the peer:// scheme to link up
+ multiple embedded brokers. See the docs for more: http://activemq.apache.org/peer-transport-reference.html
+ -->
+ <amq:broker brokerName="cafe-broker">
+ <amq:transportConnectors>
+ <amq:transportConnector name="openwire" uri="tcp://localhost:61616"/>
+ </amq:transportConnectors>
+ </amq:broker>
+
+ <!--Define an error channel that is backed by ActiveMQ. Note, by design, the error channel that's
+ created by default by SI if you don't declare one specifically will use the pub/sub messaging domain. Because
+ of that, i've chosen to keep the same messaging domain when defining the error channel explicitly. Note,
+ you can leave out this declaration, but then your error channel won't be backed by jms and can't participate
+ in the same advantages as those that are backed by JMS -->
+ <int-jms:publish-subscribe-channel id="errorChannel" topic-name="cafe.errors"/>
+
+ <int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
+
+ <!-- each order has a collection of order items that is split apart to be processed -->
+ <int-jms:channel id="orders" queue-name="cafe.orders" />
+ <int:splitter input-channel="orders" expression="payload.items" output-channel="drinks"/>
+
+ <!-- The router sends different drink orders on different paths -->
+ <int-jms:channel id="drinks" queue-name="cafe.drinks"/>
+ <int:router input-channel="drinks" expression="payload.iced ? 'coldDrinks' : 'hotDrinks'"/>
+
+ <!-- individual order items are processed by the barista -->
+ <!-- Note, these channels were defined as "pollable" in the original SI config files. To achieve the
+ same thing with a JMS-backed channel, set the "message-driven" property to "false"-->
+ <int-jms:channel id="coldDrinks" queue-name="cafe.drinks.cold" message-driven="false"/>
+ <int:service-activator input-channel="coldDrinks" ref="barista" method="prepareColdDrink" output-channel="preparedDrinks"/>
+
+ <!-- individual order items are processed by the barista -->
+ <!-- Note, these channels were defined as "pollable" in the original SI config files. To achieve the
+ same thing with a JMS-backed channel, set the "message-driven" property to "false"-->
+ <int-jms:channel id="hotDrinks" queue-name="cafe.drinks.hot" message-driven="false"/>
+ <int:service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink" output-channel="preparedDrinks"/>
+
+ <!-- drink order items are aggregated in a call to the waiter -->
+ <int-jms:channel id="preparedDrinks" queue-name="cafe.drinks.prepared"/>
+ <int-jms:channel id="deliveriesChannel" queue-name="cafe.deliveres"/>
+ <int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveriesChannel">
+ <bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
+ </int:aggregator>
+
+ <stream:stdout-channel-adapter id="deliveries" channel="deliveriesChannel"/>
+
+ <bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"/>
+
+ <int:poller id="poller" default="true" fixed-delay="1000"/>
+
+</beans>
View
80 .../cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-operations.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/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
+ queue on the broker. The queue will only be created if it doesn't exist. It will be pointed to
+ if it does exist. Don't need to "check whether a queue exists" before creating it -->
+ <bean id="cafeOrdersQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.orders"/>
+ </bean>
+
+ <int-jms:inbound-channel-adapter id="newOrdersInChannelAdapter" destination="cafeOrdersQueue" channel="jsonNewOrders"/>
+ <int:channel id="jsonNewOrders"/>
+
+ <int:chain input-channel="jsonNewOrders">
+ <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()" />
+ </int:header-enricher>
+ <int:object-to-json-transformer />
+ <int:router expression="headers.ICED ? 'coldDrinks' : 'hotDrinks'" />
+ </int:chain>
+
+ <!-- Default poller -->
+ <int:poller default="true" fixed-rate="100"/>
+
+ <int:channel id="coldDrinks">
+ <int:queue/>
+ </int:channel>
+
+ <bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.drinks.cold"/>
+ </bean>
+ <int-jms:outbound-gateway id="coldDrinksBarista"
+ request-channel="coldDrinks"
+ reply-channel="preparedJsonDrinks"
+ request-destination="coldDrinksQueue"
+ receive-timeout="30000"
+ reply-timeout="30000"/>
+
+
+ <int:channel id="hotDrinks">
+ <int:queue/>
+ </int:channel>
+ <bean id="hotDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.drinks.hot"/>
+ </bean>
+ <int-jms:outbound-gateway id="hotDrinksBarista"
+ request-channel="hotDrinks"
+ reply-channel="preparedJsonDrinks"
+ request-destination="hotDrinksQueue"
+ receive-timeout="30000"
+ reply-timeout="30000"/>
+
+ <int:channel id="preparedJsonDrinks"/>
+
+ <int:chain input-channel="preparedJsonDrinks" output-channel="deliverDrinks">
+ <int:json-to-object-transformer type="org.springframework.integration.samples.cafe.Drink"/>
+ <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>
View
33 ...cations/cafe/src/main/resources/META-INF/spring/integration/activemq/cafeDemo-amq-xml.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/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">
+
+ <int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
+ <int:channel id="orders"/>
+
+ <int:chain input-channel="orders" output-channel="jsonNewOrders">
+ <int:header-enricher>
+ <int:header name="NUMBER" expression="payload.getNumber()" />
+ </int:header-enricher>
+ <int:object-to-json-transformer />
+ </int:chain>
+
+ <int:channel id="jsonNewOrders"/>
+
+ <!--After we've converted the orders to json, we send it on its way through a JMS outbound
+ channel adapter. This is a one-way fire and forget approach. The processing will continue
+ on the otherside of the JMS queue to which the channel adapter is connected -->
+ <bean id="cafeOrdersQueue" class="org.apache.activemq.command.ActiveMQQueue">
+ <constructor-arg value="cafe.orders"/>
+ </bean>
+
+ <int-jms:outbound-channel-adapter id="jmsOrdersOutChannelAdapter" channel="jsonNewOrders" destination="cafeOrdersQueue"/>
+
+</beans>
View
2 applications/cafe/src/main/resources/META-INF/spring/integration/amqp/cafeDemo-amqp-xml.xml
@@ -5,7 +5,7 @@
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:stream="http://www.springframework.org/schema/integration/stream"
- xmlns:cloud="http://schema.cloudfoundry.org/spring"
+ xmlns:cloud="http://schema.cloudfoundry.org /spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://schema.cloudfoundry.org/spring
View
0 ...cations/cafe/src/test/resources/log4j.xml → ...cations/cafe/src/main/resources/log4j.xml
File renamed without changes.

No commit comments for this range

Something went wrong with that request. Please try again.