INTSAMPLES-60 - Polishing
This commit is contained in:
@@ -1,36 +1,39 @@
|
||||
Cafe Sample Application
|
||||
Café Sample Application
|
||||
=======================
|
||||
|
||||
The Cafe sample emulates a simple operation of the Coffee shop when modeled using Enterprise Integration Patterns (EIP). It is inspired by one of the samples featured in Gregor Hohpe's Ramblings (see Starbucks Does Not Use Two-Phase Commit: http://www.eaipatterns.com/ramblings/18_starbucks.html). The domain is that of a Cafe, and the basic flow is depicted in the following diagram:
|
||||
## Overview
|
||||
|
||||
The *Café Sample* emulates the simple operation of a coffee shop that is modeled using *[Enterprise Integration Patterns][]* (EIP). The sample is inspired by one of the samples featured in [Gregor Hohpe][]'s ramblings. For more details, please see: *[Starbucks Does Not Use Two-Phase Commit][]*. The domain is that of a [café][], and the basic flow is depicted in the following diagram:
|
||||
|
||||
|
||||
Barista
|
||||
hotDrinks ____________________
|
||||
hotDrinks ____________________
|
||||
|==========| -->| |
|
||||
orders drinks / | prepareHotDrink() |
|
||||
Place Order ->Cafe->|======|->OrderSplitter->|======|->DrinkRouter | |
|
||||
\ coldDrinks | prepareColdDrink() |
|
||||
|==========| -->| |
|
||||
|____________________|
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
The Order object may contain multiple OrderItems. Once the order is placed, a **Splitter** will break the composite order message into a single message per drink. Each of these is then processed by a **Router** that determines whether the drink is hot or cold (checking the OrderItem object's 'isIced' property). The Barista prepares each drink, but hot and cold drink preparation are handled by two distinct methods:
|
||||
The *Order* object may contain multiple *OrderItems*. Once the order is placed, a **Splitter** will break the composite order message into a single message per drink. Each of these is then processed by a **Router** that determines whether the drink is hot or cold (checking the *OrderItem* object's 'isIced' property). The *Barista* prepares each drink, but hot and cold drink preparation are handled by two distinct methods:
|
||||
|
||||
* prepareHotDrink
|
||||
* prepareColdDrink
|
||||
|
||||
The prepared drinks are then sent to the Waiter where they are aggregated into a Delivery object.
|
||||
The prepared drinks are then sent to the *Waiter* where they are aggregated into a *Delivery* object.
|
||||
|
||||
## Cafe Sample Implementations
|
||||
There are currently three implementations of the cafe sample:
|
||||
## Café Sample Implementations
|
||||
|
||||
1. Using Spring Integration channels and components
|
||||
2. Using AMQP/RabbitMQ to demonstrate a distributed architecture
|
||||
3. Using JMS/ActiveMQ to demonstrate jms-backed queues and a distributed architecture
|
||||
There are currently three implementations of the *Café Sample* that use:
|
||||
|
||||
All three implementations follow the same flow described above. See each one's README.md file for more details about the respective implementations.
|
||||
1. Spring Integration channels and components
|
||||
2. [AMQP][] ([RabbitMQ][]) to demonstrate a distributed architecture
|
||||
3. [JMS][] ([ActiveMQ][]) to demonstrate JMS-backed queues and a distributed architecture
|
||||
|
||||
All three implementations follow the same flow described above. See each one's **README.md** file for more details regarding the respective implementations.
|
||||
|
||||
Upon running any of the alternatives, you should see the output similar to this:
|
||||
|
||||
@@ -55,4 +58,13 @@ Upon running any of the alternatives, you should see the output similar to this:
|
||||
Iced MOCHA, 3 shots.
|
||||
Hot LATTE, 2 shots.
|
||||
|
||||
Happy integration :-)
|
||||
Happy integration :-)
|
||||
|
||||
[ActiveMQ]: http://activemq.apache.org/
|
||||
[AMQP]: http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol
|
||||
[café]: http://en.wikipedia.org/wiki/Caf%C3%A9
|
||||
[Enterprise Integration Patterns]: http://www.eaipatterns.com/eaipatterns.html
|
||||
[Gregor Hohpe]: http://www.eaipatterns.com/gregor.html
|
||||
[JMS]: http://en.wikipedia.org/wiki/Java_Message_Service
|
||||
[RabbitMQ]: http://www.rabbitmq.com/
|
||||
[Starbucks Does Not Use Two-Phase Commit]: http://www.eaipatterns.com/ramblings/18_starbucks.html
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
Cafe Sample Application - AMQP Implementation
|
||||
=======================
|
||||
Café Sample Application - AMQP Implementation
|
||||
=============================================
|
||||
|
||||
See the parent-level README.md for more details, but the flow of the implementation should follow this diagram:
|
||||
|
||||
|
||||
Barista
|
||||
hotDrinks ____________________
|
||||
hotDrinks ____________________
|
||||
|==========| -->| |
|
||||
orders drinks / | prepareHotDrink() |
|
||||
Place Order ->Cafe->|======|->OrderSplitter->|======|->DrinkRouter | |
|
||||
@@ -13,17 +13,17 @@ See the parent-level README.md for more details, but the flow of the implementat
|
||||
|==========| -->| |
|
||||
|____________________|
|
||||
|
||||
Legend: |====| - channels
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
## Instructions for running the CafeDemo AMQP sample
|
||||
|
||||
### Distributed components
|
||||
To run this alternative configuration of the sample, be sure to have a RabbitMQ broker started on localhost:5672 configured with the default guest|guest client credentials on the / vHost, then execute the following test classes in order:
|
||||
|
||||
|
||||
1. **cafeDemoAppBaristaColdAmqp** - starts the Cold Drink Barista
|
||||
2. **cafeDemoAppBaristaHotAmqp** - starts the Hot Drink Barista
|
||||
3. **cafeDemoAppAmqp** - starts the Cafe Storefront (Places 100 orders on the orders queue)
|
||||
4. **cafeDemoAppOperationsAmqp** - starts the Cafe Operations (OrderSplitter, DrinkRouter, PreparedDrinkAggregator)
|
||||
|
||||
|
||||
**Note**: All AMQP exchanges, queues, and bindings needed for this sample are defined within the different xml config files that support the above test classes.
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>cafe</artifactId>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>cafe</artifactId>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cafe-amqp</artifactId>
|
||||
<artifactId>cafe-amqp</artifactId>
|
||||
|
||||
<name>Cafe - With AMQP Message Broker</name>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components backed
|
||||
by an AMQP message broker for message persistence and component distribution. This
|
||||
sample uses RabbitMQ broker, but any AMQP message broker can be used. For an example
|
||||
using JMS, see the JMS implemenation of the cafe sample.
|
||||
</description>
|
||||
<name>Cafe - With AMQP Message Broker</name>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components backed
|
||||
by an AMQP message broker for message persistence and component distribution. This
|
||||
sample uses RabbitMQ broker, but any AMQP message broker can be used. For an example
|
||||
using JMS, see the JMS implementation of the cafe sample.
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-amqp</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,23 +22,23 @@ import org.springframework.integration.samples.cafe.DrinkType;
|
||||
import org.springframework.integration.samples.cafe.Order;
|
||||
|
||||
/**
|
||||
* Provides the 'main' method for running the Cafe Demo store front
|
||||
* application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When an order is
|
||||
* Provides the 'main' method for running the Cafe Demo store front
|
||||
* application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When an order is
|
||||
* placed, the Cafe store front will publish that order on the cafe-orders
|
||||
* exchange to be processed.
|
||||
* <p/>
|
||||
* The relevant components are defined within the configuration files:
|
||||
* ("cafeDemo-amqp-xml.xml", "cafeDemo-amqp-config-xml.xml").
|
||||
* ("cafeDemo-amqp-xml.xml", "cafeDemo-amqp-config-xml.xml").
|
||||
* <p/>
|
||||
* If deploying in SpringSource dmServer, the relevant ApplicationContext
|
||||
* configuration is in the META-INF/spring directory instead.
|
||||
*
|
||||
*
|
||||
* @author Tom McCuch
|
||||
*/
|
||||
public class CafeDemoAppAmqp {
|
||||
|
||||
public class CafeDemoAppAmqp {
|
||||
|
||||
/**
|
||||
* place some orders
|
||||
* @param context spring context
|
||||
@@ -55,9 +55,9 @@ public class CafeDemoAppAmqp {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
CafeDemoAppUtilities.loadProfileContext(
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-xml.xml",
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-xml.xml",
|
||||
CafeDemoAppAmqp.class,CafeDemoAppUtilities.DEV);
|
||||
order(context, 100);
|
||||
context.close();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,10 +21,10 @@ import java.io.IOException;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
|
||||
/**
|
||||
* Provides the 'main' method for running the Cafe Demo Cold Drink
|
||||
* Barista application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When a drink order
|
||||
* Provides the 'main' method for running the Cafe Demo Cold Drink
|
||||
* Barista application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When a drink order
|
||||
* is placed on the cold-drinks queue, the Barista will prepare the drink
|
||||
* and reply to the reply-to queue set by the sender.
|
||||
* <p/>
|
||||
@@ -33,23 +33,26 @@ import org.springframework.context.support.AbstractApplicationContext;
|
||||
* <p/>
|
||||
* If deploying in SpringSource dmServer, the relevant ApplicationContext
|
||||
* configuration is in the META-INF/spring directory instead.
|
||||
*
|
||||
*
|
||||
* @author Tom McCuch
|
||||
*/
|
||||
public class CafeDemoAppBaristaColdAmqp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
CafeDemoAppUtilities.loadProfileContext(
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaCold-xml.xml",
|
||||
CafeDemoAppBaristaColdAmqp.class,CafeDemoAppUtilities.DEV);
|
||||
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaCold-xml.xml",
|
||||
CafeDemoAppBaristaColdAmqp.class,CafeDemoAppUtilities.DEV);
|
||||
|
||||
System.out.println("Press Enter/Return in the console to exit the Barista Cold App");
|
||||
|
||||
try {
|
||||
System.in.read();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
context.close();
|
||||
}
|
||||
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,10 +21,10 @@ import java.io.IOException;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
|
||||
/**
|
||||
* Provides the 'main' method for running the Cafe Demo Hot Drink
|
||||
* Barista application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When a drink order
|
||||
* Provides the 'main' method for running the Cafe Demo Hot Drink
|
||||
* Barista application using AMQP. Before running, be sure to have a
|
||||
* RabbitMQ broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When a drink order
|
||||
* is placed on the hot-drinks queue, the Barista will prepare the drink
|
||||
* and reply to the reply-to queue set by the sender.
|
||||
* <p/>
|
||||
@@ -33,21 +33,23 @@ import org.springframework.context.support.AbstractApplicationContext;
|
||||
* <p/>
|
||||
* If deploying in SpringSource dmServer, the relevant ApplicationContext
|
||||
* configuration is in the META-INF/spring directory instead.
|
||||
*
|
||||
*
|
||||
* @author Tom McCuch
|
||||
*/
|
||||
public class CafeDemoAppBaristaHotAmqp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
CafeDemoAppUtilities.loadProfileContext(
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaHot-xml.xml",
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaHot-xml.xml",
|
||||
CafeDemoAppBaristaHotAmqp.class,CafeDemoAppUtilities.DEV);
|
||||
|
||||
|
||||
System.out.println("Press Enter/Return in the console to exit the Barista Hot App");
|
||||
|
||||
try {
|
||||
System.in.read();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
context.close();
|
||||
}
|
||||
context.close();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,10 +21,10 @@ import java.io.IOException;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
|
||||
/**
|
||||
* Provides the 'main' method for running the Cafe Demo Operations
|
||||
* application using AMQP. Before running, be sure to have a RabbitMQ
|
||||
* broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When an order is
|
||||
* Provides the 'main' method for running the Cafe Demo Operations
|
||||
* application using AMQP. Before running, be sure to have a RabbitMQ
|
||||
* broker started on localhost:5672 configured with the default
|
||||
* guest | guest client credentials on the / vHost. When an order is
|
||||
* placed on the new-orders queue, the Cafe Operations app will split
|
||||
* the order into order line items, route them to either the coldDrink
|
||||
* or hotDrink Barista, aggregate the prepared drinks returned from the
|
||||
@@ -32,28 +32,29 @@ import org.springframework.context.support.AbstractApplicationContext;
|
||||
* cafe-deliveries exchange.
|
||||
* <p/>
|
||||
* The relevant components are defined within the configuration files:
|
||||
* ("cafeDemo-amqp-operations-xml.xml", "cafeDemo-amqp-config-xml.xml").
|
||||
* ("cafeDemo-amqp-operations-xml.xml", "cafeDemo-amqp-config-xml.xml").
|
||||
* <p/>
|
||||
* Before starting this app, be sure to start the CafeDemoAppBaristaCold
|
||||
* and CafeDemoAppBaristaHot apps first.
|
||||
*
|
||||
*
|
||||
* If deploying in SpringSource dmServer, the relevant ApplicationContext
|
||||
* configuration is in the META-INF/spring directory instead.
|
||||
*
|
||||
*
|
||||
* @author Tom McCuch
|
||||
*/
|
||||
public class CafeDemoAppOperationsAmqp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
CafeDemoAppUtilities.loadProfileContext(
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-operations-xml.xml",
|
||||
"/META-INF/spring/integration/amqp/cafeDemo-amqp-operations-xml.xml",
|
||||
CafeDemoAppOperationsAmqp.class,CafeDemoAppUtilities.DEV);
|
||||
|
||||
System.out.println("Press Enter/Return in the console to exit the Cafe Operations App");
|
||||
|
||||
try {
|
||||
System.in.read();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
context.close();
|
||||
}
|
||||
context.close();
|
||||
|
||||
@@ -1,20 +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"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
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:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
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
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
@@ -24,10 +24,10 @@
|
||||
<import resource="classpath:META-INF/spring/integration/amqp/cafeDemo-amqp-config-xml.xml" />
|
||||
|
||||
<!-- To receive an AMQP Message from a Queue, and respond to its reply-to address, configure an inbound-gateway. -->
|
||||
<int-amqp:inbound-gateway
|
||||
<int-amqp:inbound-gateway
|
||||
id="coldDrinksBarista"
|
||||
request-channel="coldJsonDrinks"
|
||||
queue-names="cold-drinks"
|
||||
queue-names="cold-drinks"
|
||||
connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<int:chain input-channel="coldJsonDrinks">
|
||||
@@ -38,15 +38,15 @@
|
||||
<int:object-to-json-transformer />
|
||||
</int:chain>
|
||||
|
||||
<!-- rabbit exchanges, queues, and bindings used by this app -->
|
||||
<!-- rabbit exchanges, queues, and bindings used by this app -->
|
||||
<rabbit:topic-exchange name="cafe-drinks" auto-delete="true" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="cold-drinks" pattern="drink.cold"/>
|
||||
<rabbit:binding queue="all-cold-drinks" pattern="drink.cold"/>
|
||||
</rabbit:bindings>
|
||||
</rabbit:topic-exchange>
|
||||
|
||||
<rabbit:queue name="cold-drinks" auto-delete="true" durable="true"/>
|
||||
<rabbit:queue name="all-cold-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
<rabbit:queue name="cold-drinks" auto-delete="true" durable="true"/>
|
||||
<rabbit:queue name="all-cold-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,20 +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"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
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:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
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
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
@@ -24,10 +24,10 @@
|
||||
<import resource="classpath:META-INF/spring/integration/amqp/cafeDemo-amqp-config-xml.xml" />
|
||||
|
||||
<!-- To receive an AMQP Message from a Queue, and respond to its reply-to address, configure an inbound-gateway. -->
|
||||
<int-amqp:inbound-gateway
|
||||
<int-amqp:inbound-gateway
|
||||
id="hotDrinksBarista"
|
||||
request-channel="hotJsonDrinks"
|
||||
queue-names="hot-drinks"
|
||||
queue-names="hot-drinks"
|
||||
connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<int:chain input-channel="hotJsonDrinks">
|
||||
@@ -45,8 +45,8 @@
|
||||
<rabbit:binding queue="all-hot-drinks" pattern="drink.hot"/>
|
||||
</rabbit:bindings>
|
||||
</rabbit:topic-exchange>
|
||||
|
||||
<rabbit:queue name="hot-drinks" auto-delete="true" durable="true"/>
|
||||
<rabbit:queue name="all-hot-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
<rabbit:queue name="hot-drinks" auto-delete="true" durable="true"/>
|
||||
<rabbit:queue name="all-hot-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,39 +1,36 @@
|
||||
<?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:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:cloud="http://schema.cloudfoundry.org/spring"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
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
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd">
|
||||
|
||||
<!-- Set up the AmqpTemplate/RabbitTemplate: -->
|
||||
<rabbit:template id="amqpTemplate"
|
||||
connection-factory="rabbitConnectionFactory" reply-timeout="10000" />
|
||||
<!-- Set up the AmqpTemplate/RabbitTemplate: -->
|
||||
<rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" reply-timeout="10000" />
|
||||
|
||||
<!-- Request that queues, exchanges and bindings be automatically declared
|
||||
on the broker: -->
|
||||
<rabbit:admin connection-factory="rabbitConnectionFactory" />
|
||||
<!-- Request that queues, exchanges and bindings be automatically declared
|
||||
on the broker: -->
|
||||
<rabbit:admin connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<!-- profiles must be the last element sin the file -->
|
||||
|
||||
<!-- Obtain a connection to the RabbitMQ via cloudfoundry-runtime: -->
|
||||
<beans profile="cloud">
|
||||
<cloud:rabbit-connection-factory
|
||||
id="rabbitConnectionFactory" />
|
||||
</beans>
|
||||
<!-- profiles must be the last element sin the file -->
|
||||
|
||||
<!-- connect to the local broker using the default user name and password -->
|
||||
<beans profile="dev">
|
||||
<bean id="rabbitConnectionFactory"
|
||||
class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
|
||||
<constructor-arg value="localhost" />
|
||||
<property name="username" value="guest" />
|
||||
<property name="password" value="guest" />
|
||||
</bean>
|
||||
</beans>
|
||||
<!-- Obtain a connection to the RabbitMQ via cloudfoundry-runtime: -->
|
||||
<beans profile="cloud">
|
||||
<cloud:rabbit-connection-factory id="rabbitConnectionFactory" />
|
||||
</beans>
|
||||
|
||||
<!-- connect to the local broker using the default user name and password -->
|
||||
<beans profile="dev">
|
||||
<bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
|
||||
<constructor-arg value="localhost" />
|
||||
<property name="username" value="guest" />
|
||||
<property name="password" value="guest" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,20 +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"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
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:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
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
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
@@ -23,12 +23,12 @@
|
||||
<import resource="classpath:META-INF/spring/integration/amqp/cafeDemo-amqp-config-xml.xml" />
|
||||
|
||||
<!-- intercept messages on these channels while still allowing them to continue -->
|
||||
<int:wire-tap channel="logger" pattern="orders,coldDrinks,hotDrinks,preparedDrinks,deliveries"/>
|
||||
<int:wire-tap channel="logger" pattern="orders,coldDrinks,hotDrinks,preparedDrinks,deliveries"/>
|
||||
<int:logging-channel-adapter id="logger" log-full-message="true" level="INFO"/>
|
||||
|
||||
<!-- To receive AMQP Messages from a Queue, configure an inbound-channel-adapter -->
|
||||
|
||||
<!-- To receive AMQP Messages from a Queue, configure an inbound-channel-adapter -->
|
||||
<int-amqp:inbound-channel-adapter queue-names="new-orders" channel="jsonOrders" connection-factory="rabbitConnectionFactory" acknowledge-mode="AUTO" />
|
||||
|
||||
|
||||
<int:json-to-object-transformer id="json-to-order" input-channel="jsonOrders" output-channel="preOrders" type="org.springframework.integration.samples.cafe.Order" />
|
||||
|
||||
<int:splitter input-channel="preOrders" expression="payload.items" output-channel="preDrinks" apply-sequence="true"/>
|
||||
@@ -47,36 +47,36 @@
|
||||
|
||||
<!-- Default poller -->
|
||||
<int:poller default="true" fixed-rate="100"/>
|
||||
|
||||
|
||||
<int:channel id="hotDrinks">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<!-- To send AMQP Messages to an Exchange and receive back a response from a remote client, configure an outbound-gateway -->
|
||||
<int-amqp:outbound-gateway
|
||||
id="coldDrinksBarista"
|
||||
<!-- To send AMQP Messages to an Exchange and receive back a response from a remote client, configure an outbound-gateway -->
|
||||
<int-amqp:outbound-gateway
|
||||
id="coldDrinksBarista"
|
||||
request-channel="coldDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
exchange-name="cafe-drinks"
|
||||
routing-key="drink.cold"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<!-- To send AMQP Messages to an Exchange and receive back a response from a remote client, configure an outbound-gateway -->
|
||||
<int-amqp:outbound-gateway
|
||||
id="hotDrinksBarista"
|
||||
<!-- To send AMQP Messages to an Exchange and receive back a response from a remote client, configure an outbound-gateway -->
|
||||
<int-amqp:outbound-gateway
|
||||
id="hotDrinksBarista"
|
||||
request-channel="hotDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
exchange-name="cafe-drinks"
|
||||
routing-key="drink.hot"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<int:channel id="preparedJsonDrinks"/>
|
||||
<int:channel id="preparedJsonDrinks"/>
|
||||
|
||||
<int:json-to-object-transformer id="json-to-drink" input-channel="preparedJsonDrinks" output-channel="preparedDrinks" type="org.springframework.integration.samples.cafe.Drink"/>
|
||||
|
||||
<int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="preDeliveries">
|
||||
<bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
</int:aggregator>
|
||||
<int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="preDeliveries">
|
||||
<bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
</int:aggregator>
|
||||
|
||||
<int:channel id="preDeliveries" />
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<int:object-to-json-transformer id="delivery-to-json" input-channel="deliveries" output-channel="jsonDeliveries"/>
|
||||
|
||||
<int:channel id="jsonDeliveries" />
|
||||
|
||||
|
||||
<!-- To send AMQP Messages to an Exchange, configure an outbound-channel-adapter. -->
|
||||
<int-amqp:outbound-channel-adapter
|
||||
id="deliveredOrders"
|
||||
@@ -97,22 +97,23 @@
|
||||
routing-key-expression="'delivery.'+headers.NUMBER" />
|
||||
|
||||
<bean id="waiter" class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
|
||||
|
||||
<!-- rabbit exchanges, queues, and bindings used by this app -->
|
||||
<rabbit:topic-exchange name="cafe-drinks" auto-delete="true" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="all-drinks" pattern="drink.*"/>
|
||||
</rabbit:bindings>
|
||||
</rabbit:topic-exchange>
|
||||
|
||||
<rabbit:queue name="all-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
<rabbit:queue name="all-drinks" auto-delete="true" durable="true"/>
|
||||
|
||||
<rabbit:fanout-exchange name="cafe-deliveries" auto-delete="false" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="all-deliveries" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:fanout-exchange>
|
||||
|
||||
<rabbit:queue name="all-deliveries" auto-delete="false" durable="true"/>
|
||||
|
||||
<rabbit:queue name="all-deliveries" auto-delete="false" durable="true"/>
|
||||
<rabbit:queue name="new-orders" auto-delete="false" durable="true"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,20 +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"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
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:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
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
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp
|
||||
http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit
|
||||
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<!-- spring integration flow -->
|
||||
<int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe" />
|
||||
|
||||
|
||||
<int:channel id="orders"/>
|
||||
|
||||
<int:header-enricher input-channel="orders" output-channel="newOrders">
|
||||
@@ -32,16 +32,16 @@
|
||||
</int:header-enricher>
|
||||
|
||||
<int:object-to-json-transformer input-channel="newOrders" output-channel="jsonNewOrders" />
|
||||
|
||||
|
||||
<int:channel id="jsonNewOrders" />
|
||||
|
||||
|
||||
<!-- To send AMQP Messages to an Exchange, configure an outbound-channel-adapter. -->
|
||||
<int-amqp:outbound-channel-adapter
|
||||
<int-amqp:outbound-channel-adapter
|
||||
channel="jsonNewOrders"
|
||||
exchange-name="cafe-orders"
|
||||
routing-key-expression="'order.'+headers.NUMBER"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
exchange-name="cafe-orders"
|
||||
routing-key-expression="'order.'+headers.NUMBER"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<!-- rabbit exchanges, queues, and bindings used by this app -->
|
||||
<rabbit:topic-exchange name="cafe-orders" auto-delete="false" durable="true">
|
||||
<rabbit:bindings>
|
||||
@@ -49,8 +49,8 @@
|
||||
<rabbit:binding queue="all-orders" pattern="order.*"/>
|
||||
</rabbit:bindings>
|
||||
</rabbit:topic-exchange>
|
||||
|
||||
<rabbit:queue name="new-orders" auto-delete="false" durable="true"/>
|
||||
<rabbit:queue name="all-orders" auto-delete="false" durable="true"/>
|
||||
|
||||
<rabbit:queue name="new-orders" auto-delete="false" durable="true"/>
|
||||
<rabbit:queue name="all-orders" auto-delete="false" durable="true"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,19 +1,19 @@
|
||||
Cafe Sample Application - JMS Implementation
|
||||
=======================
|
||||
Café Sample Application - JMS Implementation
|
||||
============================================
|
||||
|
||||
See the parent-level README.md for more details, but the flow of the implementation should follow this diagram:
|
||||
See the parent-level **README.md** for more details, but the flow of the implementation should follow this diagram:
|
||||
|
||||
|
||||
Barista
|
||||
hotDrinks ____________________
|
||||
hotDrinks ____________________
|
||||
|==========| -->| |
|
||||
orders drinks / | prepareHotDrink() |
|
||||
Place Order ->Cafe->|======|->OrderSplitter->|======|->DrinkRouter | |
|
||||
\ coldDrinks | prepareColdDrink() |
|
||||
|==========| -->| |
|
||||
|____________________|
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
## Instructions for running the CafeDemo JMS sample
|
||||
|
||||
@@ -1,48 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>cafe</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>cafe</artifactId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cafe-jms</artifactId>
|
||||
<artifactId>cafe-jms</artifactId>
|
||||
<name>Cafe - With JMS Message Broker</name>
|
||||
|
||||
<name>Cafe - With JMS Message Broker</name>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components backed
|
||||
by a JMS broker for persistent messaging as well as component distribution. This
|
||||
sample uses ActiveMQ as the JMS broker, but any JMS-compliant broker can be
|
||||
used. For an example using AMQP, see the AMQP implementation of the cafe sample.
|
||||
</description>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components backed
|
||||
by a JMS broker for persistent messaging as well as component distribution. This
|
||||
sample uses ActiveMQ as the JMS broker, but any JMS-compliant broker can be
|
||||
used. For an example using AMQP, see the AMQP implementation of the cafe sample.
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<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>
|
||||
<properties>
|
||||
<activemq.version>5.6.0</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.11.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-jms</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
@@ -13,14 +28,15 @@ import java.io.IOException;
|
||||
* is running, simply press <return> or any other key to end the application. To fully experience the
|
||||
* benefits of this solution, try halting/exiting the program in the middle of running it, comment out the
|
||||
* call to place new orders (the order() function call) and watch that the processing still continues
|
||||
* where it left off when you halted it. This is because the messages are persisted in the ActiveMQ queues
|
||||
* where it left off when you halted it. This is because the messages are persisted in the ActiveMQ queues.
|
||||
*
|
||||
* @author ceposta
|
||||
* @author Christian Posta
|
||||
*/
|
||||
public class CafeDemoActiveMQBackedChannels {
|
||||
|
||||
/**
|
||||
* place some orders
|
||||
* Place some orders.
|
||||
*
|
||||
* @param context spring context
|
||||
* @param count the number of standard orders
|
||||
*/
|
||||
@@ -35,13 +51,14 @@ public class CafeDemoActiveMQBackedChannels {
|
||||
}
|
||||
|
||||
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");
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-jms-backed.xml");
|
||||
|
||||
// comment this out to run the sample without placing any new orders on the queue
|
||||
order(context, 25);
|
||||
// comment this out to run the sample without placing any new orders on the queue
|
||||
order(context, 25);
|
||||
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
@@ -11,14 +26,15 @@ import java.io.IOException;
|
||||
/**
|
||||
* Main class for sending orders that will be handled in separate, distributed
|
||||
* processes. See the README.md file for more information on the order in which
|
||||
* to start the processes
|
||||
* to start the processes.
|
||||
*
|
||||
* @author ceposta
|
||||
* @author Christian Posta
|
||||
*/
|
||||
public class CafeDemoAppActiveMQ {
|
||||
|
||||
/**
|
||||
* place some orders
|
||||
* Place some orders.
|
||||
*
|
||||
* @param context spring context
|
||||
* @param count the number of standard orders
|
||||
*/
|
||||
@@ -33,9 +49,10 @@ public class CafeDemoAppActiveMQ {
|
||||
}
|
||||
|
||||
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);
|
||||
context.close();
|
||||
}
|
||||
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);
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,43 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Main class for starting up the distributed task of handling/creating the Cold
|
||||
* beverages. See the README.md file for more information on the order in which
|
||||
* to start the processes
|
||||
* to start the processes.
|
||||
*
|
||||
* @author ceposta
|
||||
* @author Christian Posta
|
||||
*/
|
||||
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");
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-baristaCold-xml.xml");
|
||||
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
@@ -8,19 +23,20 @@ import java.io.IOException;
|
||||
/**
|
||||
* Main class for starting up the distributed task of handling/creating the Hot¡
|
||||
* beverages. See the README.md file for more information on the order in which
|
||||
* to start the processes
|
||||
* to start the processes.
|
||||
*
|
||||
* @author ceposta
|
||||
* @author Christian Posta
|
||||
*/
|
||||
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");
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-baristaHot-xml.xml");
|
||||
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
@@ -11,19 +26,20 @@ import java.io.IOException;
|
||||
* and delivering them to the waiters.
|
||||
*
|
||||
* See the README.md file for more information on the order in which
|
||||
* to start the processes
|
||||
* to start the processes.
|
||||
*
|
||||
* @author ceposta
|
||||
* @author Christian Posta
|
||||
*/
|
||||
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");
|
||||
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml",
|
||||
"/META-INF/spring/integration/activemq/cafeDemo-amq-operations.xml");
|
||||
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
System.out.println("Press Enter/Return to exit");
|
||||
System.in.read();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<?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">
|
||||
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">
|
||||
|
||||
<!-- The name of the queue to which to connect to receive cold drink orders-->
|
||||
<bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<!-- The name of the queue to which to connect to receive cold drink orders-->
|
||||
<bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="org.springframework.integration.samples.cafe.drinks.cold"/>
|
||||
</bean>
|
||||
|
||||
<!-- The gateway responsible for request/reply semantics -->
|
||||
<int-jms:inbound-gateway request-channel="coldJsonDrinks" request-destination="coldDrinksQueue"/>
|
||||
<int:channel id="coldJsonDrinks" />
|
||||
<!-- The gateway responsible for request/reply semantics -->
|
||||
<int-jms:inbound-gateway request-channel="coldJsonDrinks" request-destination="coldDrinksQueue"/>
|
||||
<int:channel id="coldJsonDrinks" />
|
||||
|
||||
<!-- The chain of processing for this barista -->
|
||||
<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>
|
||||
<!-- The chain of processing for this barista -->
|
||||
<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>
|
||||
@@ -1,26 +1,29 @@
|
||||
<?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">
|
||||
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">
|
||||
|
||||
|
||||
<!-- The name of the queue to which to connect to receive cold drink orders-->
|
||||
<bean id="hotDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<!-- The name of the queue to which to connect to receive cold drink orders-->
|
||||
<bean id="hotDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="org.springframework.integration.samples.cafe.drinks.hot"/>
|
||||
</bean>
|
||||
|
||||
<!-- The gateway responsible for request/reply semantics -->
|
||||
<int-jms:inbound-gateway request-channel="hotJsonDrinks" request-destination="hotDrinksQueue"/>
|
||||
<int:channel id="hotJsonDrinks" />
|
||||
|
||||
<!-- The chain of processing for this barista -->
|
||||
<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>
|
||||
<!-- The gateway responsible for request/reply semantics -->
|
||||
<int-jms:inbound-gateway request-channel="hotJsonDrinks" request-destination="hotDrinksQueue"/>
|
||||
<int:channel id="hotJsonDrinks" />
|
||||
|
||||
<!-- The chain of processing for this barista -->
|
||||
<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>
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
<?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 ">
|
||||
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"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="sessionCacheSize" value="10"/>
|
||||
<property name="cacheProducers" value="false"/>
|
||||
</bean>
|
||||
|
||||
<!-- 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"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="sessionCacheSize" value="10"/>
|
||||
<property name="cacheProducers" value="false"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -1,68 +1,69 @@
|
||||
<?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">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-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.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>
|
||||
<!-- 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="org.springframework.integration.samples.cafe.errors"/>
|
||||
<!--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="org.springframework.integration.samples.cafe.errors"/>
|
||||
|
||||
<int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
|
||||
<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="org.springframework.integration.samples.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="org.springframework.integration.samples.cafe.drinks"/>
|
||||
<int-jms:channel id="drinks" queue-name="org.springframework.integration.samples.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="org.springframework.integration.samples.cafe.drinks.cold" message-driven="false"/>
|
||||
<!-- 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="org.springframework.integration.samples.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="org.springframework.integration.samples.cafe.drinks.hot" message-driven="false"/>
|
||||
<!-- 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="org.springframework.integration.samples.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="org.springframework.integration.samples.cafe.drinks.prepared"/>
|
||||
<int-jms:channel id="deliveriesChannel" queue-name="org.springframework.integration.samples.cafe.deliveres"/>
|
||||
<int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveriesChannel">
|
||||
<bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
</int:aggregator>
|
||||
<int-jms:channel id="preparedDrinks" queue-name="org.springframework.integration.samples.cafe.drinks.prepared"/>
|
||||
<int-jms:channel id="deliveriesChannel" queue-name="org.springframework.integration.samples.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"/>
|
||||
<int-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>
|
||||
</beans>
|
||||
|
||||
@@ -1,80 +1,83 @@
|
||||
<?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">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-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">
|
||||
<!--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="org.springframework.integration.samples.cafe.orders"/>
|
||||
</bean>
|
||||
|
||||
<int-jms:inbound-channel-adapter id="newOrdersInChannelAdapter" destination="cafeOrdersQueue" channel="jsonNewOrders"/>
|
||||
<int:channel id="jsonNewOrders"/>
|
||||
<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>
|
||||
<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"/>
|
||||
<!-- Default poller -->
|
||||
<int:poller default="true" fixed-rate="100"/>
|
||||
|
||||
<int:channel id="coldDrinks">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
<int:channel id="coldDrinks">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="coldDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="org.springframework.integration.samples.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-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">
|
||||
|
||||
<bean id="hotDrinksQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<constructor-arg value="org.springframework.integration.samples.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-jms:outbound-gateway id="hotDrinksBarista"
|
||||
request-channel="hotDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
request-destination="hotDrinksQueue"
|
||||
receive-timeout="30000"
|
||||
reply-timeout="30000"/>
|
||||
|
||||
<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="preparedJsonDrinks"/>
|
||||
|
||||
<int:channel id="deliverDrinks"/>
|
||||
<stream:stdout-channel-adapter id="deliveriesStdout" channel="deliverDrinks"/>
|
||||
<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"/>
|
||||
<int-stream:stdout-channel-adapter id="deliveriesStdout" channel="deliverDrinks"/>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
<?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">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-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">
|
||||
|
||||
<int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
|
||||
<int:channel id="orders"/>
|
||||
<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: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"/>
|
||||
<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">
|
||||
<!--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="org.springframework.integration.samples.cafe.orders"/>
|
||||
</bean>
|
||||
|
||||
<int-jms:outbound-channel-adapter id="jmsOrdersOutChannelAdapter" channel="jsonNewOrders" destination="cafeOrdersQueue"/>
|
||||
<int-jms:outbound-channel-adapter id="jmsOrdersOutChannelAdapter" channel="jsonNewOrders" destination="cafeOrdersQueue"/>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%t %-5p: %c - %m%n" />
|
||||
<param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
Cafe Sample Application - Pure SI Implementation
|
||||
=======================
|
||||
Café Sample Application - Pure SI Implementation
|
||||
================================================
|
||||
|
||||
See the parent-level README.md for more details, but the flow of the implementation should follow this diagram:
|
||||
See the parent-level **README.md** for more details, but the flow of the implementation should follow this diagram:
|
||||
|
||||
|
||||
Barista
|
||||
hotDrinks ____________________
|
||||
hotDrinks ____________________
|
||||
|==========| -->| |
|
||||
orders drinks / | prepareHotDrink() |
|
||||
Place Order ->Cafe->|======|->OrderSplitter->|======|->DrinkRouter | |
|
||||
\ coldDrinks | prepareColdDrink() |
|
||||
|==========| -->| |
|
||||
|____________________|
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
Legend: |====| - channels
|
||||
|
||||
|
||||
## Instructions for running the CafeDemo sample
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>cafe</artifactId>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>cafe</artifactId>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>cafe-si</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Cafe - Pure Spring Integration</name>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components.
|
||||
The channels that are used are in-memory channels and there is no distribution of
|
||||
the processes (i.e., all of the processing happens within the same JVM and there
|
||||
is no message broker). To see the cafe sample with a message broker to help distribute
|
||||
the components, see the AMQP or the JMS sample.
|
||||
</description>
|
||||
<name>Cafe - Pure Spring Integration</name>
|
||||
<description>
|
||||
This module implements the cafe sample using spring-integration components.
|
||||
The channels that are used are in-memory channels and there is no distribution of
|
||||
the processes (i.e., all of the processing happens within the same JVM and there
|
||||
is no message broker). To see the cafe sample with a message broker to help distribute
|
||||
the components, see the AMQP or the JMS sample.
|
||||
</description>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,16 +19,16 @@ package org.springframework.integration.samples.cafe;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
|
||||
/**
|
||||
* The entry point for Cafe Demo. The demo's main() method invokes the
|
||||
* The entry point for the Cafe Demo. The demo's main() method invokes the
|
||||
* '<code>placeOrder</code>' method on a generated MessagingGateway proxy.
|
||||
* The gateway then passes the {@link Order} as the payload of a
|
||||
* {@link org.springframework.integration.Message} to the
|
||||
* configured <em>requestChannel</em>. The channel ('orders') is
|
||||
* defined in the 'cafeDemo.xml' file.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public interface Cafe {
|
||||
public interface Cafe {
|
||||
|
||||
@Gateway(requestChannel="orders")
|
||||
void placeOrder(Order order);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,12 +22,15 @@ import java.util.List;
|
||||
/**
|
||||
* @author Marius Bogoevici
|
||||
* @author Tom McCuch
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class Delivery implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String SEPARATOR = "-----------------------";
|
||||
|
||||
private List<Drink> deliveredDrinks;
|
||||
private List<Drink> deliveredDrinks;
|
||||
|
||||
private int orderNumber;
|
||||
|
||||
@@ -36,27 +39,27 @@ public class Delivery implements Serializable{
|
||||
|
||||
public Delivery(List<Drink> deliveredDrinks) {
|
||||
assert(deliveredDrinks.size() > 0);
|
||||
this.deliveredDrinks = deliveredDrinks;
|
||||
this.deliveredDrinks = deliveredDrinks;
|
||||
this.orderNumber = deliveredDrinks.get(0).getOrderNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getOrderNumber() {
|
||||
public int getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public void setOrderNumber(int orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public void setOrderNumber(int orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public List<Drink> getDeliveredDrinks() {
|
||||
return deliveredDrinks;
|
||||
}
|
||||
return deliveredDrinks;
|
||||
}
|
||||
|
||||
public void setDeliveredDrinks(List<Drink> deliveredDrinks) {
|
||||
this.deliveredDrinks = deliveredDrinks;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer(SEPARATOR + "\n");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,27 +21,29 @@ import java.io.Serializable;
|
||||
/**
|
||||
* @author Marius Bogoevici
|
||||
* @author Tom McCuch
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class Drink implements Serializable{
|
||||
|
||||
private boolean iced;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int shots;
|
||||
private boolean iced;
|
||||
|
||||
private DrinkType drinkType;
|
||||
private int shots;
|
||||
|
||||
private DrinkType drinkType;
|
||||
|
||||
private int orderNumber;
|
||||
|
||||
|
||||
// Default constructor required by Jackson Java JSON-processor
|
||||
public Drink() {}
|
||||
|
||||
public Drink(int orderNumber, DrinkType drinkType, boolean iced, int shots) {
|
||||
this.orderNumber = orderNumber;
|
||||
this.drinkType = drinkType;
|
||||
this.iced = iced;
|
||||
this.shots = shots;
|
||||
}
|
||||
this.orderNumber = orderNumber;
|
||||
this.drinkType = drinkType;
|
||||
this.iced = iced;
|
||||
this.shots = shots;
|
||||
}
|
||||
|
||||
|
||||
public int getOrderNumber() {
|
||||
@@ -75,10 +77,10 @@ public class Drink implements Serializable{
|
||||
public void setShots(int shots) {
|
||||
this.shots = shots;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (iced?"Iced":"Hot") + " " + drinkType.toString() + ", " + shots + " shots.";
|
||||
}
|
||||
public String toString() {
|
||||
return (iced?"Iced":"Hot") + " " + drinkType.toString() + ", " + shots + " shots.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,9 +24,12 @@ import java.util.List;
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
* @author Tom McCuch
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class Order implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<OrderItem> orderItems = new ArrayList<OrderItem>();
|
||||
|
||||
/** the order number used for tracking */
|
||||
@@ -50,7 +53,7 @@ public class Order implements Serializable{
|
||||
public void setNumber(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
|
||||
public List<OrderItem> getItems() {
|
||||
return this.orderItems;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,27 +22,30 @@ import java.io.Serializable;
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
* @author Tom McCuch
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class OrderItem implements Serializable {
|
||||
|
||||
private DrinkType type;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int shots = 1;
|
||||
private DrinkType type;
|
||||
|
||||
private boolean iced = false;
|
||||
private int shots = 1;
|
||||
|
||||
/** the order this item is tied to */
|
||||
private boolean iced = false;
|
||||
|
||||
/** the order this item is tied to */
|
||||
private int orderNumber;
|
||||
|
||||
// Default constructor required by Jackson Java JSON-processor
|
||||
public OrderItem() {}
|
||||
|
||||
public OrderItem(int orderNumber, DrinkType type, int shots, boolean iced) {
|
||||
this.orderNumber = orderNumber;
|
||||
this.orderNumber = orderNumber;
|
||||
this.type = type;
|
||||
this.shots = shots;
|
||||
this.iced = iced;
|
||||
}
|
||||
this.shots = shots;
|
||||
this.iced = iced;
|
||||
}
|
||||
|
||||
public int getOrderNumber() {
|
||||
return this.orderNumber;
|
||||
@@ -51,33 +54,33 @@ public class OrderItem implements Serializable {
|
||||
public void setOrderNumber(int orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
|
||||
public boolean isIced() {
|
||||
return this.iced;
|
||||
}
|
||||
return this.iced;
|
||||
}
|
||||
|
||||
public void setIced(boolean iced) {
|
||||
this.iced = iced;
|
||||
}
|
||||
|
||||
|
||||
public int getShots() {
|
||||
return shots;
|
||||
}
|
||||
return shots;
|
||||
}
|
||||
|
||||
public void setShots(int shots) {
|
||||
this.shots = shots;
|
||||
}
|
||||
|
||||
public DrinkType getDrinkType() {
|
||||
return this.type;
|
||||
}
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setDrinkType(DrinkType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ((this.iced) ? "iced " : "hot ") + this.shots + " shot " + this.type;
|
||||
}
|
||||
return ((this.iced) ? "iced " : "hot ") + this.shots + " shot " + this.type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,16 +28,16 @@ import org.springframework.integration.samples.cafe.Order;
|
||||
* The channels are defined within the configuration file ("cafeDemo.xml"),
|
||||
* and the relevant components are configured with annotations (such as the
|
||||
* OrderSplitter, DrinkRouter, and Barista classes).
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public class CafeDemoApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-annotation.xml", CafeDemoApp.class);
|
||||
|
||||
|
||||
Cafe cafe = (Cafe) context.getBean("cafe");
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
Order order = new Order(i);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,14 +30,14 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class Waiter {
|
||||
|
||||
@Aggregator(inputChannel = "preparedDrinks", outputChannel = "deliveries")
|
||||
public Delivery prepareDelivery(List<Drink> drinks) {
|
||||
return new Delivery(drinks);
|
||||
}
|
||||
|
||||
@CorrelationStrategy
|
||||
public int correlateByOrderNumber(Drink drink) {
|
||||
return drink.getOrderNumber();
|
||||
}
|
||||
|
||||
@Aggregator(inputChannel = "preparedDrinks", outputChannel = "deliveries")
|
||||
public Delivery prepareDelivery(List<Drink> drinks) {
|
||||
return new Delivery(drinks);
|
||||
}
|
||||
|
||||
@CorrelationStrategy
|
||||
public int correlateByOrderNumber(Drink drink) {
|
||||
return drink.getOrderNumber();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.integration.samples.cafe.Order;
|
||||
* <p/>
|
||||
* If deploying in SpringSource dmServer, the relevant ApplicationContext
|
||||
* configuration is in the META-INF/spring directory instead.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -38,9 +38,9 @@ import org.springframework.integration.samples.cafe.Order;
|
||||
public class CafeDemoApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AbstractApplicationContext context =
|
||||
AbstractApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-xml.xml", CafeDemoApp.class);
|
||||
|
||||
|
||||
Cafe cafe = (Cafe) context.getBean("cafe");
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
Order order = new Order(i);
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.samples.cafe.xml;
|
||||
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
*
|
||||
*/
|
||||
public class CafeDemoAppUtilities {
|
||||
|
||||
/** spring profile for running locally */
|
||||
@@ -10,15 +30,14 @@ public class CafeDemoAppUtilities {
|
||||
/** spring profile for running in cloud foundry */
|
||||
public static final String CLOUD = "cloud";
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param path path to the file
|
||||
* @param targetClass the class who's classloader we will use to laod the context file
|
||||
* @param profile a profile name
|
||||
* @return the spring context
|
||||
*/
|
||||
public static AbstractApplicationContext loadProfileContext(String path, Class targetClass, String profile) {
|
||||
public static AbstractApplicationContext loadProfileContext(String path, Class<?> targetClass, String profile) {
|
||||
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
|
||||
ctx.getEnvironment().setActiveProfiles(profile);
|
||||
ctx.setClassLoader(targetClass.getClassLoader());
|
||||
@@ -26,8 +45,5 @@ public class CafeDemoAppUtilities {
|
||||
ctx.refresh();
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,8 +26,8 @@ import org.springframework.integration.samples.cafe.Drink;
|
||||
*/
|
||||
public class Waiter {
|
||||
|
||||
public Delivery prepareDelivery(List<Drink> drinks) {
|
||||
return new Delivery(drinks);
|
||||
}
|
||||
public Delivery prepareDelivery(List<Drink> drinks) {
|
||||
return new Delivery(drinks);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
<beans:beans xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.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/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.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">
|
||||
|
||||
<annotation-config/>
|
||||
<int:annotation-config/>
|
||||
|
||||
<context:component-scan base-package="org.springframework.integration.samples.cafe.annotation"/>
|
||||
|
||||
<gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
|
||||
<int:gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
|
||||
|
||||
<channel id="orders"/>
|
||||
<channel id="drinks"/>
|
||||
<channel id="coldDrinks"><queue capacity="10"/></channel>
|
||||
<channel id="hotDrinks"><queue capacity="10"/></channel>
|
||||
<channel id="coldDrinkBarista"/>
|
||||
<channel id="hotDrinkBarista"/>
|
||||
<channel id="preparedDrinks"/>
|
||||
<int:channel id="orders"/>
|
||||
<int:channel id="drinks"/>
|
||||
<int:channel id="coldDrinks"><int:queue capacity="10"/></int:channel>
|
||||
<int:channel id="hotDrinks"><int:queue capacity="10"/></int:channel>
|
||||
<int:channel id="coldDrinkBarista"/>
|
||||
<int:channel id="hotDrinkBarista"/>
|
||||
<int:channel id="preparedDrinks"/>
|
||||
|
||||
<bridge input-channel="coldDrinks" output-channel="coldDrinkBarista">
|
||||
<poller fixed-delay="1000"/>
|
||||
</bridge>
|
||||
<int:bridge input-channel="coldDrinks" output-channel="coldDrinkBarista">
|
||||
<int:poller fixed-delay="1000"/>
|
||||
</int:bridge>
|
||||
|
||||
<bridge input-channel="hotDrinks" output-channel="hotDrinkBarista">
|
||||
<poller fixed-delay="1000"/>
|
||||
</bridge>
|
||||
<int:bridge input-channel="hotDrinks" output-channel="hotDrinkBarista">
|
||||
<int:poller fixed-delay="1000"/>
|
||||
</int:bridge>
|
||||
|
||||
<int-stream:stdout-channel-adapter id="deliveries"/>
|
||||
|
||||
<stream:stdout-channel-adapter id="deliveries"/>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
<beans:beans xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
|
||||
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/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">
|
||||
|
||||
<gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
|
||||
<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 -->
|
||||
<channel id="orders"/>
|
||||
<splitter input-channel="orders" expression="payload.items" output-channel="drinks"/>
|
||||
<int:channel id="orders"/>
|
||||
<int:splitter input-channel="orders" expression="payload.items" output-channel="drinks"/>
|
||||
|
||||
<!-- The router sends different drink orders on different paths -->
|
||||
<channel id="drinks"/>
|
||||
<router input-channel="drinks" expression="payload.iced ? 'coldDrinks' : 'hotDrinks'"/>
|
||||
<int:channel id="drinks"/>
|
||||
<int:router input-channel="drinks" expression="payload.iced ? 'coldDrinks' : 'hotDrinks'"/>
|
||||
|
||||
<!-- individual order items are processed by the barista -->
|
||||
<channel id="coldDrinks">
|
||||
<queue capacity="10"/>
|
||||
</channel>
|
||||
<service-activator input-channel="coldDrinks" ref="barista" method="prepareColdDrink" output-channel="preparedDrinks"/>
|
||||
<int:channel id="coldDrinks">
|
||||
<int:queue capacity="10"/>
|
||||
</int:channel>
|
||||
<int:service-activator input-channel="coldDrinks" ref="barista" method="prepareColdDrink" output-channel="preparedDrinks"/>
|
||||
|
||||
<!-- individual order items are processed by the barista -->
|
||||
<channel id="hotDrinks">
|
||||
<queue capacity="10"/>
|
||||
</channel>
|
||||
<service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink" output-channel="preparedDrinks"/>
|
||||
<int:channel id="hotDrinks">
|
||||
<int:queue capacity="10"/>
|
||||
</int:channel>
|
||||
<int:service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink" output-channel="preparedDrinks"/>
|
||||
|
||||
<!-- drink order items are aggregated in a call to the waiter -->
|
||||
<channel id="preparedDrinks"/>
|
||||
<aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveries">
|
||||
<beans:bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
</aggregator>
|
||||
<int:channel id="preparedDrinks"/>
|
||||
<int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveries">
|
||||
<beans:bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
</int:aggregator>
|
||||
|
||||
<stream:stdout-channel-adapter id="deliveries"/>
|
||||
<int-stream:stdout-channel-adapter id="deliveries"/>
|
||||
|
||||
<beans:bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"/>
|
||||
|
||||
<poller id="poller" default="true" fixed-delay="1000"/>
|
||||
<int:poller id="poller" default="true" fixed-delay="1000"/>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%t %-5p: %c - %m%n" />
|
||||
<param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -4,32 +4,39 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration.samples</groupId>
|
||||
<artifactId>cafe</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
<modules>
|
||||
<module>cafe-jms</module>
|
||||
<module>cafe-si</module>
|
||||
<module>cafe-amqp</module>
|
||||
</modules>
|
||||
<name>Samples (Applications) - Cafe Sample</name>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.1.0.BUILD-SNAPSHOT</version>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<modules>
|
||||
<module>cafe-jms</module>
|
||||
<module>cafe-si</module>
|
||||
<module>cafe-amqp</module>
|
||||
</modules>
|
||||
|
||||
<name>Samples (Applications) - Cafe Sample</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
|
||||
<spring.core.version>3.1.0.RELEASE</spring.core.version>
|
||||
<spring.core.version>3.1.0.RELEASE</spring.core.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${spring.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${spring.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-stream</artifactId>
|
||||
@@ -37,14 +44,14 @@
|
||||
</dependency>
|
||||
<!-- Jackson JSON Mapper -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
<version>1.9.2</version>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.2</version>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
@@ -69,7 +76,7 @@
|
||||
<target>1.5</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
Reference in New Issue
Block a user