interim commit
changed copyright on Order.java
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
<version>2.0.0</version>
|
||||
<name>Spring Integration Cafe Sample</name>
|
||||
<properties>
|
||||
<spring.integration.version>2.0.5.RELEASE</spring.integration.version>
|
||||
<spring.integration.version>2.1.0.M3</spring.integration.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<junit.version>4.7</junit.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<artifactId>spring-integration-amqp</artifactId>
|
||||
<version>${spring.integration.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 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-2011 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.
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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-amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:cloud="http://schema.cloudfoundry.org/spring"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://schema.cloudfoundry.org/spring
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
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/spring-rabbit-1.0.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
|
||||
<int-amqp:inbound-gateway
|
||||
id="coldDrinksBarista"
|
||||
request-channel="coldJsonDrinks"
|
||||
queue-names="cold-drinks"
|
||||
connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<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>
|
||||
|
||||
<!-- Use this when running locally -->
|
||||
<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>
|
||||
|
||||
<!-- Use this when running in Cloud Foundry -->
|
||||
<!-- <cloud:rabbit-connection-factory id="rabbitConnectionFactory" service-name="cafe-rabbit"/> -->
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<rabbit:admin connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<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"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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-amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:cloud="http://schema.cloudfoundry.org/spring"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://schema.cloudfoundry.org/spring
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
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/spring-rabbit-1.0.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
|
||||
<int-amqp:inbound-gateway
|
||||
id="hotDrinksBarista"
|
||||
request-channel="hotJsonDrinks"
|
||||
queue-names="hot-drinks"
|
||||
connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<!-- Use this when running locally -->
|
||||
<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>
|
||||
|
||||
<!-- Use this when running in Cloud Foundry -->
|
||||
<!-- <cloud:rabbit-connection-factory id="rabbitConnectionFactory" service-name="cafe-rabbit"/> -->
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<rabbit:admin connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<rabbit:topic-exchange name="cafe-drinks" auto-delete="true" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="hot-drinks" pattern="drink.hot"/>
|
||||
<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"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,133 @@
|
||||
<?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-amqp="http://www.springframework.org/schema/integration/amqp"
|
||||
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:cloud="http://schema.cloudfoundry.org/spring"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://schema.cloudfoundry.org/spring
|
||||
http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
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/spring-rabbit-1.0.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
|
||||
|
||||
<int:wire-tap channel="logger" pattern="orders,coldDrinks,hotDrinks,preparedDrinks,deliveries"/>
|
||||
<int:logging-channel-adapter id="logger" log-full-message="true" level="INFO"/>
|
||||
|
||||
<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="orders" type="org.springframework.integration.samples.cafe.Order" />
|
||||
|
||||
<int:splitter input-channel="orders" expression="payload.items" output-channel="preDrinks" apply-sequence="true"/>
|
||||
|
||||
<int:header-enricher input-channel="preDrinks" output-channel="drinks">
|
||||
<int:header name="ICED" expression="payload.isIced()"/>
|
||||
</int:header-enricher>
|
||||
|
||||
<int:object-to-json-transformer id="drink-to-json" input-channel="drinks" output-channel="jsonDrinks" />
|
||||
|
||||
<int:router input-channel="jsonDrinks" expression="headers.ICED ? 'coldDrinks' : 'hotDrinks'"/>
|
||||
|
||||
<int:channel id="coldDrinks">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<!-- Default poller -->
|
||||
<int:poller default="true" fixed-rate="100"/>
|
||||
|
||||
<int:channel id="hotDrinks">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int-amqp:outbound-gateway
|
||||
id="coldDrinksBarista"
|
||||
request-channel="coldDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
exchange-name="cafe-drinks"
|
||||
routing-key="drink.cold"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<int-amqp:outbound-gateway
|
||||
id="hotDrinksBarista"
|
||||
request-channel="hotDrinks"
|
||||
reply-channel="preparedJsonDrinks"
|
||||
exchange-name="cafe-drinks"
|
||||
routing-key="drink.hot"
|
||||
amqp-template="amqpTemplate" />
|
||||
|
||||
<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:channel id="preDeliveries" />
|
||||
|
||||
<int:header-enricher input-channel="preDeliveries" output-channel="deliveries">
|
||||
<int:header name="NUMBER" expression="payload.getOrderNumber()" />
|
||||
</int:header-enricher>
|
||||
|
||||
<int:object-to-json-transformer id="delivery-to-json" input-channel="deliveries" output-channel="jsonDeliveries"/>
|
||||
|
||||
<int:channel id="jsonDeliveries" />
|
||||
|
||||
<int-amqp:outbound-channel-adapter
|
||||
id="deliveredOrders"
|
||||
channel="jsonDeliveries"
|
||||
amqp-template="amqpTemplate"
|
||||
exchange-name="cafe-deliveries"
|
||||
routing-key-expression="'delivery.'+headers.NUMBER" />
|
||||
|
||||
<bean id="waiter" class="org.springframework.integration.samples.cafe.xml.Waiter"/>
|
||||
|
||||
<!-- Use this when running locally -->
|
||||
<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>
|
||||
|
||||
<!-- Use this when running in Cloud Foundry -->
|
||||
<!-- <cloud:rabbit-connection-factory id="rabbitConnectionFactory" service-name="cafe-rabbit"/> -->
|
||||
|
||||
<rabbit:template id="amqpTemplate" connection-factory="rabbitConnectionFactory" reply-timeout="10000"/>
|
||||
|
||||
<rabbit:admin connection-factory="rabbitConnectionFactory" />
|
||||
|
||||
<rabbit:topic-exchange name="cafe-orders" auto-delete="true" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="new-orders" pattern="order.*"/>
|
||||
<rabbit:binding queue="all-orders" pattern="order.*"/>
|
||||
</rabbit:bindings>
|
||||
</rabbit:topic-exchange>
|
||||
|
||||
<rabbit:queue name="new-orders" auto-delete="true" durable="true"/>
|
||||
<rabbit:queue name="all-orders" auto-delete="true" durable="true"/>
|
||||
|
||||
<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:fanout-exchange name="cafe-deliveries" auto-delete="true" durable="true">
|
||||
<rabbit:bindings>
|
||||
<rabbit:binding queue="all-deliveries" />
|
||||
</rabbit:bindings>
|
||||
</rabbit:fanout-exchange>
|
||||
|
||||
<rabbit:queue name="all-deliveries" auto-delete="true" durable="true"/>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user