Skip to content

Commit 3c9c91c

Browse files
committed
INTSAMPLES-89 - Upgrade to Spring Integration 2.2 RC3
* Test samples * Polish documentation * Polish code For reference see: https://jira.springsource.org/browse/INTSAMPLES-89
1 parent 251e035 commit 3c9c91c

File tree

93 files changed

+1688
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1688
-1476
lines changed

README.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Spring Integration Samples
33

44
# Introduction
55

6-
Welcome to the Spring Integration Samples. To simplify your experience, Spring Integration Samples were split into 4 distinct categories:
6+
Welcome to the **Spring Integration Samples** repository which provides **50+ samples** to help you learn [Spring Integration][]. To simplify your experience, the *Spring Integration* samples are split into 4 distinct categories:
77

88
* Basic
99
* Intermediate
1010
* Advanced
1111
* Applications
1212

13-
Inside of each category you'll find a 'README.md' which will contain a more detailed description of that category's specifics. Each sample also comes with its own 'readme.txt' file explaining details.
13+
Inside of each category you'll find a **README.md** file, which will contain a more detailed description of that category. Each sample also comes with its own **README.md** file explaining further details, e.g. how to run the respective sample.
1414

1515
*Happy Integration!*
1616

@@ -31,21 +31,26 @@ Below is a short description of each category.
3131

3232
This is a good place to get started. The samples here are technically motivated and demonstrate the bare minimum with regard to configuration and code to help you to get introduced to the basic concepts, API and configuration of Spring Integration. For example, if you are looking for an answer on how to wire a **Service Activator** to a **Channel** or how to apply a **Gateway** to your message exchange or how to get started with using the **MAIL** or **XML** module, this would be the right place to find a relevant sample. The bottom line is that this is a good starting point.
3333

34-
* **amqp** - demonstrates the functionality of the various **AMQP Adapters**
35-
* **control-bus** - demonstrates the functionality of the **Control Bus**
36-
* **feed** - demonstrates the functionality of the **Feed Adapter** (RSS/ATOM)
37-
* **file** - demonstrates aspects of the various File Adapters (e.g. **File Inbound/Outbound Channel Adapters**, file **polling**)
38-
* **ftp** - demonstrates the **FTP support** available with Spring Integration
39-
* **helloworld** - very simple starting example illustrating a basic message flow (using **Channel**, **ServiceActivator**, **QueueChannel**)
40-
* **http** - demonstrates request/reply communication when using a pair of **HTTP Inbound/Outbound gateways**
41-
* **jms** - demonstrates **JMS** support available with Spring Integration
42-
* **jmx** - demonstrates **JMX** support using a **JMX Attribute Polling Channel** and **JMX Operation Invoking Channel Adapter**
43-
* **mail** - example showing **IMAP** and **POP3** support
34+
* **amqp** - Demonstrates the functionality of the various **AMQP Adapters**
35+
* **control-bus** - Demonstrates the functionality of the **Control Bus**
36+
* **enricher** - This sample demonstrates how the Enricher components can be used
37+
* **feed** - Demonstrates the functionality of the **Feed Adapter** (RSS/ATOM)
38+
* **file** - Demonstrates aspects of the various File Adapters (e.g. **File Inbound/Outbound Channel Adapters**, file **polling**)
39+
* **ftp** - Demonstrates the **FTP support** available with Spring Integration
40+
* **helloworld** - Very simple starting example illustrating a basic message flow (using **Channel**, **ServiceActivator**, **QueueChannel**)
41+
* **http** - Demonstrates request/reply communication when using a pair of **HTTP Inbound/Outbound gateways**
42+
* **jdbc** - Illustrates the usage of the Jdbc Adapters, including object persistence and retrieval
43+
* **jms** - Demonstrates **JMS** support available with Spring Integration
44+
* **jmx** - Demonstrates **JMX** support using a **JMX Attribute Polling Channel** and **JMX Operation Invoking Channel Adapter**
45+
* **jpa** - Shows the usage of the JPA Components can be used
46+
* **mail** - Example showing **IMAP** and **POP3** support
47+
* **mongodb** - Shows how to persist a Message payload to a **MongoDb** document store and how to read documents from **MongoDb**
4448
* **oddeven** - Example combining the functionality of **Inbound Channel Adapter**, **Filter**, **Router** and **Poller**
4549
* **jpa** - This sample illustrates how the JPA Components can be used
4650
* **quote** - Example demoing core EIP support using **Channel Adapter (Inbound and Stdout)**, **Poller** with Interval Trigers, **Service Activator**
47-
* **sftp** - demonstrating SFTP support using **SFTP Inbound / Outbound Channel Adapters**
48-
* **tcp-client-server** - demonstrates socket communication using **TcpOutboundGateway**, **TcpInboundGateway** and also uses a **Gateway** and a **Service Activator**
51+
* **sftp** - Demonstrating SFTP support using **SFTP Inbound / Outbound Channel Adapters**
52+
* **tcp-amqp** - Demonstrates basic functionality of bridging the **Spring Integration TCP Adapters** with **Spring Integration AMQP Adapters**
53+
* **tcp-client-server** - Demonstrates socket communication using **TcpOutboundGateway**, **TcpInboundGateway** and also uses a **Gateway** and a **Service Activator**
4954
* **testing-examples** - A series of test cases that show techniques to **test** Spring Integration applications.
5055
* **twitter** - Illustrates Twitter support using the **Twitter Inbound Channel Adapter**, **Twitter Inbound Search Channel Adapter**, **Twitter Outbound Channel Adapter**
5156
* **ws-inbound-gateway** - Example showing basic functionality of the **Web Service Gateway**
@@ -58,36 +63,41 @@ This is a good place to get started. The samples here are technically motivated
5863

5964
This category targets developers who are already more familiar with the Spring Integration framework (past getting started), but need some more guidance while resolving more advanced technical problems that you have to deal with when switching to a Messaging architecture. For example, if you are looking for an answer on how to handle errors in various scenarios, or how to properly configure an **Aggregator** for the situations where some messages might not ever arrive for aggregation, or any other issue that goes beyond a basic understanding and configuration of a particular component to address "what else you can do?" types of problems, this would be the right place to find relevant examples.
6065

66+
* **async-gateway** - Usage example of an asynchronous **Gateway**
6167
* **dynamic-poller** - Example shows usage of a **Poller** with a custom **Trigger** to change polling periods at runtime
6268
* **async-gateway** - Example shows usage of an **Asynchronous Gateway**
6369
* **errorhandling** - Demonstrates basic **Error Handling** capabilities of Spring Integration
6470
* **file-processing** - Sample demonstrates how to wire a message flow to process files either sequentially (maintain the order) or concurrently (no order).
6571
* **mail-attachments** - Demonstrates the processing of email attachments
72+
* **monitoring** The project used in the *[Spring Integration Management and Monitoring Webinar](http://www.springsource.org/node/3598)* Also available on the *[SpringSourceDev YouTube Channel](http://www.youtube.com/SpringSourceDev)*
6673
* **multipart-http** - Demonstrates the sending of HTTP multipart requests using Spring's **RestTemplate** and a Spring Integration **Http Outbound Gateway**
67-
* **travel** - More sophisticated example showing the retrieval of weather (SOAP Web Service) and traffic (HTTP Service) reports using real services
68-
* **tcp-client-server-multiplex** - Demonstrates the use of *Collaborating Channel Adapters*
69-
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
70-
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
71-
* **stored-procedures-postgresql** Provides an example of the stored procedure Outbound Gateway using *[PostgreSQL](http://www.postgresql.org/)*
7274
* **rest-http** - This sample demonstrates how to send an HTTP request to a Spring Integration's HTTP service while utilizing Spring Integration's new HTTP Path usage. This sample also uses Spring Security for HTTP Basic authentication. With HTTP Path facility, the client program can send requests with URL Variables.
75+
* **retry-and-more** Provides samples showing the application of MessageHandler Advice Chains to endpoints - retry, circuit breaker, expression evaluating
7376
* **splitter-aggregator-reaper** A demonstration of implementing the Splitter and Aggregator *Enterprise Integration Patterns* (EIP) together. This sample also provides a concrete example of a [message store reaper][] in action.
7477
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
78+
* **stored-procedures-ms** Provides an example of the stored procedure Outbound Gateway using *Microsoft SQL Server*
7579
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
76-
* **monitoring** The project used in the *[Spring Integration Management and Monitoring Webinar](http://www.springsource.org/node/3598)* Also available on the *[SpringSourceDev YouTube Channel](http://www.youtube.com/SpringSourceDev)*
77-
* **retry-and-more** Provides samples showing the application of MessageHandler Advice Chains to endpoints - retry, circuit breaker, expression evaluating
78-
* **tx-synch** Provides a sample demonstrating the use of transaction syncrhonization, renaming an input file to a different filename, depending on whether the transaction commits, or rolls back.
80+
* **stored-procedures-postgresql** Provides an example of the stored procedure Outbound Gateway using *[PostgreSQL](http://www.postgresql.org/)*
81+
* **tcp-client-server-multiplex** - Demonstrates the use of *Collaborating Channel Adapters*
82+
* **travel** - More sophisticated example showing the retrieval of weather (SOAP Web Service) and traffic (HTTP Service) reports using real services
83+
* **tx-synch** Provides a sample demonstrating the use of transaction synchronization, renaming an input file to a different filename, depending on whether the transaction commits, or rolls back.
7984

8085
## Advanced
8186

8287
This category targets advanced developers who are quite familiar with Spring Integration but are looking to address a specific custom need by extending the Spring Integration public API. For example, if you are looking for samples showing how to implement a custom **Channel** or **Consumer** (event-based or polling-based), or you are trying to figure out what is the most appropriate way to implement a custom **BeanParser** on top of the Spring Integration BeanParser hierarchy when implementing a custom namespace, this would be the right place to look. Here you can also find samples that will help you with adapter development. Spring Integration comes with an extensive library of adapters that allow you to connect remote systems with the Spring Integration messaging framework. However you might have a need to integrate with a system for which the core framework does not provide an adapter, so you have to implement your own. This category would include samples showing you how to implement various adapters.
8388

8489
* **advanced-testing-examples** - Example test cases that show advanced techniques to test Spring Integration applications
90+
* **dynamic-ftp** - Demonstrates one technique for sending files to dynamic destinations.
8591

8692
## Applications
8793

8894
This category targets developers and architects who have a good understanding of Message-Driven architecture and Enterprise Integration Patterns, and have an above average understanding of Spring and Spring integration and who are looking for samples that address a particular business problem. In other words, the emphasis of samples in this category is '**business use cases**' and how they can be solved via a Messaging architecture and Spring Integration in particular. For example, if you are interested to see how a Loan Broker process or Travel Agent process could be implemented and automated via Spring Integration, this would be the right place to find these types of samples.
8995

90-
* **cafe** - Emulates a simple operation of a coffee shop combining various Spring Integration adapters (Including **Router** and **Splitter**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details
96+
* **cafe** - Emulates a simple operation of a coffee shop combining various Spring Integration adapters (Including **Router** and **Splitter**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details. Implementations are provided for:
97+
- AMQP
98+
- JMS
99+
- In memory channels
100+
* **cafe-scripted** - Scripted implementation of the classic **cafe** sample application. Supports **JavaScript**, **Groovy**, **Ruby**, and **Python**.
91101
* **loan-broker** - Simulates a simple banking application (Uses **Gateway**, **Chain**, **Header Enricher**, **Recipient List Router**, **Aggregator**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details
92102
* **loanshark** This extension to the loan broker sample shows how to exchange messages between Spring Integration applications (and other technologies) using **UDP**.
93103

advanced/advanced-testing-examples/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.springframework.integration.samples</groupId>
66
<artifactId>advanced-testing-examples</artifactId>
7-
<version>2.1.0.BUILD-SNAPSHOT</version>
7+
<version>2.2.0.BUILD-SNAPSHOT</version>
88
<name>Samples (Advanced) - Advanced Testing Examples</name>
99
<packaging>jar</packaging>
1010
<properties>
11-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12-
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
13-
<spring.version>3.1.0.RELEASE</spring.version>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
<spring.integration.version>2.2.0.RC3</spring.integration.version>
13+
<spring.version>3.1.3.RELEASE</spring.version>
1414
<log4j.version>1.2.16</log4j.version>
1515
<junit.version>4.10</junit.version>
1616
</properties>

advanced/dynamic-ftp/pom.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.springframework.integration.samples</groupId>
44
<artifactId>dynamic-ftp</artifactId>
5-
<version>2.1.0.BUILD-SNAPSHOT</version>
5+
<version>2.2.0.BUILD-SNAPSHOT</version>
66
<name>Samples (Advanced) - Dynamic FTP Demo</name>
77
<packaging>jar</packaging>
88
<properties>
9-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10-
<spring.framework.version>3.1.0.RELEASE</spring.framework.version>
11-
<spring.integration.version>2.2.0.M1</spring.integration.version>
12-
<log4j.version>1.2.16</log4j.version>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
<spring.framework.version>3.1.3.RELEASE</spring.framework.version>
11+
<spring.integration.version>2.2.0.RC3</spring.integration.version>
12+
<log4j.version>1.2.17</log4j.version>
1313
<junit.version>4.10</junit.version>
1414
</properties>
1515
<dependencies>
@@ -54,17 +54,18 @@
5454
<plugin>
5555
<groupId>org.apache.maven.plugins</groupId>
5656
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>2.3.2</version>
57+
<version>2.5.1</version>
5858
<configuration>
59-
<source>1.5</source>
60-
<target>1.5</target>
59+
<source>1.6</source>
60+
<target>1.6</target>
6161
<compilerArgument>-Xlint:all</compilerArgument>
6262
<showWarnings>true</showWarnings>
63-
<showDeprecation>false</showDeprecation>
63+
<showDeprecation>true</showDeprecation>
6464
</configuration>
6565
</plugin>
6666
<plugin>
6767
<artifactId>maven-surefire-plugin</artifactId>
68+
<version>2.12.4</version>
6869
<configuration>
6970
<includes>
7071
<include>**/*Tests.java</include>

advanced/dynamic-ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundChannelAdapterSample.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.context.support.ClassPathXmlApplicationContext;
2727
import org.springframework.integration.Message;
2828
import org.springframework.integration.MessageChannel;
29-
import org.springframework.integration.MessageHandlingException;
3029
import org.springframework.integration.MessagingException;
3130
import org.springframework.integration.support.MessageBuilder;
3231

@@ -50,14 +49,14 @@ public void runDemo() throws Exception{
5049
channel.send(message);
5150
} catch (MessagingException e) {
5251
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
53-
assertEquals("host.for.cust1", e.getCause().getCause().getMessage());
52+
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust1"));
5453
}
5554
// send another so we can see in the log we don't create the ac again.
5655
try {
5756
channel.send(message);
5857
} catch (MessagingException e) {
5958
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
60-
assertEquals("host.for.cust1", e.getCause().getCause().getMessage());
59+
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust1"));
6160
}
6261
// send to a different customer; again, check the log to see a new ac is built
6362
message = MessageBuilder.withPayload(file)
@@ -66,21 +65,21 @@ public void runDemo() throws Exception{
6665
channel.send(message);
6766
} catch (MessagingException e) {
6867
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
69-
assertEquals("host.for.cust2", e.getCause().getCause().getMessage());
68+
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust2"));
7069
}
71-
72-
// send to a different customer; again, check the log to see a new ac is built
70+
71+
// send to a different customer; again, check the log to see a new ac is built
7372
//and the first one created (cust1) should be closed and removed as per the max cache size restriction
7473
message = MessageBuilder.withPayload(file)
7574
.setHeader("customer", "cust3").build();
7675
try {
7776
channel.send(message);
7877
} catch (MessagingException e) {
7978
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
80-
assertEquals("host.for.cust3", e.getCause().getCause().getMessage());
79+
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust3"));
8180
}
82-
83-
//send to cust1 again, since this one has been invalidated before, we should
81+
82+
//send to cust1 again, since this one has been invalidated before, we should
8483
//see a new ac created (with ac of cust2 destroyed and removed)
8584
message = MessageBuilder.withPayload(file)
8685
.setHeader("customer", "cust1").build();

advanced/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.springframework.integration.samples</groupId>
77
<artifactId>advanced-samples</artifactId>
8-
<version>2.1.0.RELEASE</version>
8+
<version>2.2.0.BUILD-SNAPSHOT</version>
99
<name>Spring Integration Samples - Advanced</name>
1010
<packaging>pom</packaging>
1111

applications/cafe-scripted/pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.springframework.integration.samples</groupId>
66
<artifactId>cafe-scripted</artifactId>
7-
<version>2.1.0.BUILD-SNAPSHOT</version>
7+
<version>2.2.0.BUILD-SNAPSHOT</version>
88
<name>Samples (Applications) - Cafe Sample (Scripted Implementation)</name>
99
<properties>
10-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11-
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
12-
<spring.version>3.1.0.RELEASE</spring.version>
13-
<log4j.version>1.2.16</log4j.version>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<spring.integration.version>2.2.0.RC3</spring.integration.version>
12+
<spring.version>3.1.3.RELEASE</spring.version>
13+
<log4j.version>1.2.17</log4j.version>
1414
<junit.version>4.10</junit.version>
1515
</properties>
1616

@@ -114,13 +114,13 @@
114114
<plugin>
115115
<groupId>org.apache.maven.plugins</groupId>
116116
<artifactId>maven-compiler-plugin</artifactId>
117-
<version>2.3.2</version>
117+
<version>2.5.1</version>
118118
<configuration>
119-
<source>1.5</source>
119+
<source>1.6</source>
120120
<target>1.6</target>
121121
<compilerArgument>-Xlint:all</compilerArgument>
122122
<showWarnings>true</showWarnings>
123-
<showDeprecation>false</showDeprecation>
123+
<showDeprecation>true</showDeprecation>
124124
</configuration>
125125
</plugin>
126126
</plugins>

applications/cafe/cafe-amqp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>cafe</artifactId>
88
<groupId>org.springframework.integration.samples</groupId>
9-
<version>2.1.0.BUILD-SNAPSHOT</version>
9+
<version>2.2.0.BUILD-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>cafe-amqp</artifactId>

0 commit comments

Comments
 (0)