diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
index 1ce3e9a7ec..c37d23538d 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
@@ -22,11 +22,7 @@
-
-
-
-
-
+
diff --git a/spring-integration-reference/src/samples.xml b/spring-integration-reference/src/samples.xml
index 197baf3874..e80aafe3f5 100644
--- a/spring-integration-reference/src/samples.xml
+++ b/spring-integration-reference/src/samples.xml
@@ -35,14 +35,15 @@
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/integration
+ http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
@@ -50,15 +51,14 @@
-
+
-
+
+
]]>
Notice that the Message Bus is defined. It will automatically detect and register all channels and endpoints.
The 'annotation-driven' element will enable the detection of the splitter and router - both of which carry
@@ -83,13 +83,13 @@ public class DrinkRouter {
}]]>
- Now turning back to the XML, you see that there are two <endpoint> elements. Each of these is delegating
- to the same Barista instance but different methods. The 'barista' could have been
- defined in the XML, but instead the @Component annotation is applied:
+ Now turning back to the XML, you see that there are two <service-activator> elements. Each of these
+ is delegating to the same Barista instance but different methods. The 'barista' could
+ have been defined in the XML, but instead the @Component annotation is applied:
- As you can see from the code excerpt above, the barista methods have different delays. This simulates work being
- completed at different rates. When the CafeDemo 'main' method runs, it will loop 100
+ As you can see from the code excerpt above, the barista methods have different delays (the hot
+ drinks take 5 times as long to prepare). This simulates work being completed at different rates.
+ When the CafeDemo 'main' method runs, it will loop 100
times sending a single hot drink and a single cold drink each time.
When you run cafeDemo, you will see that all 100 cold drinks are prepared in roughly the same amount of time as
- only 50 of the hot drinks. This is to be expected based on their respective delays of 1000 and 2000 milliseconds.
- However, by configuring the endpoint concurrency, you can dramatically change the results. For example, on my
- machine, the following single modification causes all 100 hot drinks to be prepared before the 5th cold drink is
- ready:
-
+ only 20 of the hot drinks. This is to be expected based on their respective delays of 1000 and 5000 milliseconds.
+ However, by configuring the endpoint concurrency, you can dramatically change the results. For example, to level
+ the playing field, you could add a concurrency interceptor with 5 workers for the hot drink barista:
+
-
- ]]>]]>]]>
+
+
+ ]]>]]>
+]]>
- In addition to experimenting with the 'concurrency' settings, you can also try adding the 'schedule' sub-element
- as described in . Additionally, you can experiment with the channel's
- configuration, such as adding a 'dispatcher-policy' as described in . If you
- want to explore the sample in more detail, the source JAR is available in the "src" directory:
+ Also, notice that the worker thread name is displayed with each invocation. You should see that most of
+ the hot drinks are prepared by the concurrency-interceptor threads, but that occassionally it throttles
+ the input by forcing the message-bus (the caller) to invoke the operation. In addition to experimenting
+ with the 'concurrency' settings, you can also try adding the 'schedule' sub-element as described in
+ . If you want to explore the sample in more detail, the source JAR
+ is available in the "src" directory:
'org.springframework.integration.samples-sources-1.0.0.M4.jar'.