INTSAMPLES-42 rename readme.txt files to README.md

This commit is contained in:
Gunnar Hillert
2012-01-08 01:01:15 -05:00
parent 7b27f0a8ea
commit 1905d1a46c
54 changed files with 751 additions and 822 deletions

View File

@@ -0,0 +1,11 @@
Control Bus Sample
==================
This example demonstrates the functionality of the Control Bus component available with Spring Integration. The Control Bus uses SpEL to send a Control Message to start/stop an inbound adapter. To run the Control Bus sample simply execute **ControlBusDemoTest** in the **org.springframework.integration.samples.controlbus** package.
You will see output similar to this:
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: null
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: [Payload=Hello][Headers={timestamp=1294950897714, id=240e72fb-93b0-4d38-8fe8-b701cf7e9a5d}]
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received after adapter stopped: null

View File

@@ -1,12 +0,0 @@
This example demonstrates the functionality of the Control Bus component available with Spring Integration:
Control Bus uses SpEL to send a Control Message to start/stop and inbound adapter
To run Control Bus sample simple execute ControlBusDemoTest
You will see the output similar to this
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: null
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: [Payload=Hello][Headers={timestamp=1294950897714, id=240e72fb-93b0-4d38-8fe8-b701cf7e9a5d}]
INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received after adapter stopped: null

View File

@@ -1,5 +1,5 @@
Spring Integration - Enricher Sample
================================
====================================
# Overview

5
basic/feed/README.md Normal file
View File

@@ -0,0 +1,5 @@
RSS Feed Sample
===============
This example demonstrates the usage of the Spring Integration RSS Feed Module using a **Feed Inbound Channel Adapter**. In order to run the sample, execute the test case located in the **org.springframework.integration.samples.feed** package.

View File

@@ -1,21 +0,0 @@
This example demonstrates the following aspects of the FEED (RSS/ATOM) support available with Spring Integration:
1. FEED Inbound Channel Adapter (receives news feeds)
#### INBOUND CHANNEL ADAPTER ####
To run INBOUND CHANNEL ADAPTER sample execute FeedInboundChannelAdapterSample test and you'll receive the feed entries for the
given URL. Feel free to plug in your own URL
The output should look similar to this:
=====
Thu Nov 18 01:28:54 EST 2010 - Rangel awaits House sanctions
Thu Nov 18 05:43:11 EST 2010 - Tweet lands woman in China labor camp
Thu Nov 18 06:13:24 EST 2010 - Bird flu is back in Hong Kong
Thu Nov 18 07:09:17 EST 2010 - Computer worm called 'game changer'
Thu Nov 18 08:00:11 EST 2010 - Murkowski declares victory in Alaska
Thu Nov 18 08:50:04 EST 2010 - Family awaits hanging verdict for mom
Thu Nov 18 09:14:20 EST 2010 - Suspect bag on Germany-bound plane
Thu Nov 18 09:47:15 EST 2010 - Zakaria: How serious is this deficit?
Thu Nov 18 09:51:15 EST 2010 - Two former Madoff employees arrested
Thu Nov 18 11:15:22 EST 2010 - WikiLeaks founder wanted in rape case
=====

View File

@@ -1,13 +1,18 @@
File Sample
===========
This example demonstrates the following aspects of the File operations support available with Spring Integration:
1. File Inbound Channel Adapter
2. File Outbound Channel Adapter
3. File-to-Bytes Transformer
as well as Poller
Furthermore, a Poller is used as well.
The use case is a simple file copy, but implemented in 3 basic flavors:
1. Binary file copy
2. Text file copy
3. Simple file copy
To run samples simply execute the 3 test cases located in the org.springframework.integration.samples.filecopy package
To run the samples simply execute the 3 test cases located in the **org.springframework.integration.samples.filecopy** package.

View File

@@ -0,0 +1,8 @@
Hello World Sample
==================
This is an obvious place to get started. It demonstrates a simple message flow represented by the diagram below:
Message -> Channel -> ServiceActivator -> QueueChannel
To run sample simply execute a test case in the **org.springframework.integration.samples.helloworld** package.

View File

@@ -1,5 +0,0 @@
This is an obvious place to get started. It demonstrates a simple message flow represented by the diagram below:
Message -> Channel -> ServiceActivator -> QueueChannel
To run sample simply execute a test case in org.springframework.integration.samples.helloworld package

15
basic/http/README.md Normal file
View File

@@ -0,0 +1,15 @@
Http Sample
===========
This example demonstrates simple request/reply communication when using a pair of **HTTP Inbound/Outbound Gateways**.
It consists of two parts - Client and Server. To run this sample:
1. Deploy project
* If you are using STS and project is imported as Eclipse project in your workspace you can just execute **Run on Server**
* You can also run **mvn clean install** and generate the WAR file that you can deploy the conventional way
2. Run the simple test client program: **org.springframework.integration.samples.http.DemoHttpClient**
The gateway initiates a simple request posting "Hello" to the server and server responds by appending **from the other side** to the message payload and returns. You should see the following output from the server:
INFO : org.springframework.integration.samples.http.HttpClientDemo - Replied with: Hello from the other side

View File

@@ -1,16 +0,0 @@
This example demonstrates simple request/reply communication when using a pair of HTTP Inbound/Outbound gateways
It consists of two parts - Client and Server.
To run this sample
1) deploy project
- If you are using STS and project is imported as Eclipse project in your workspace you can just execute 'Run on Server'
- You can also run 'mvn clean install' and generate the WAR file that you can deploy the conventional way
2) run the simple test client program: org.springframework.integration.samples.http.DemoHttpClient
The gateway initiates a simple request posting "Hello" to the server and server responds by appending "from the other side"
to the message payload and returns.
You should see the following output from the server:
INFO : org.springframework.integration.samples.http.HttpClientDemo - Replied with: Hello from the other side

25
basic/jms/README.md Normal file
View File

@@ -0,0 +1,25 @@
JMS Sample
==========
This example demonstrates the following aspects of the JMS support available with Spring Integration:
1. JMS Message-driven Channel Adapter
2. JMS Inbound Gateway
3. JMS Outbound Gateway
It also uses the following components:
1. Poller
2. Stdout Channel Adapter (from Stream support Module)
3. Stdin Channel Adapter (from Stream support Module)
The Stdout and Stdin Channel Adapters will allow you to interact with JMS via the console. It uses an embedded ActiveMQ broker.
To run the samples, simply execute the **GatewayDemo** and **ChannelAdapterDemo** classes located in the *org.springframework.integration.samples.jms* package.
When running demos you will see the following prompt:
> Please type something and hit return
* **GatewayDemo** uses *DemoBean* service, which will echo the response, upper-casing it.
* **ChannelAdapterDemo** will simply echo the response

View File

@@ -1,16 +0,0 @@
This example demonstrates the following aspects of the JMS support available with Spring Integration:
1. JMS Message-driven Channel Adapter
2. JMS Inbound Gateway
3. JMS Outbound Gateway
as well as Poller and stdout and stdin Channel Adapters (from Stream support) which will allow you to interact with JMS via the console.
It uses ActiveMQ embedded broker
To run samples simply execute GatewayDemo and ChannelAdapterDemo classes located in the org.springframework.integration.samples.jms package
When running demos you will see the following prompt:
> Please type something and hit return
GatewayDemo uses DemoBean service which will echo the response upper-casing it
ChannelAdapterDemo will simply echo the response

38
basic/jmx/README.md Normal file
View File

@@ -0,0 +1,38 @@
JMX Sample
==========
This example demonstrates the following aspects of the JMX support available with Spring Integration:
1. JMX Attribute Polling Channel
2. JMX Operation Invoking Channel Adapter
**StopWatch** is a Managed Bean. It is bootstraped and deployed using annotation support (*@Component*, *@ManagedResource*) and component scanning functionality provided by Spring JMX. Internally StopWatch simply runs a task that increments the value of its **seconds** attribute by 1 every second.
The **JMX Attribute Polling Channel Adapter** simply polls a managed attribute **seconds** of the **StopWatch** MBean identified by the name:
org.springframework.integration.samples.jmx:type=StopWatch,name=stopWatch
It sends its value to a **seconds** channel. The interesting part is that the **seconds** channel is a *publish-subscribe-channel* and has two subscribers:
- **Stdout Channel Adapter** which prints the value of the polled attribute to the console
- **Filter** which essentially waits till the payload value is 10
Once the payload value is 10, the filter sends the Message to a **reset** channel, which is represented as **JMX Operation Invoking Channel Adapter**. That adapter simply invokes the **reset** operation on the same **StopWatch** MBean resetting the **seconds** attribute value back to 1 and the process repeats.
To run the JMX Adapter sample simply execute **JmxAdapterDemoTest**. You will see output similar to this, which will loop for ~20 seconds:
1
2
3
4
5
6
7
8
9
10
1
2
3
. . .

View File

@@ -1,33 +0,0 @@
This example demonstrates the following aspects of the JMX support available with Spring Integration:
1. JMX Attribute Polling Channel
2. JMX Operation Invoking Channel Adapter
StopWatch is a Managed Bean. It is bootstraped and deployed using annotation support (@Component, @ManagedResource)
and component scanning functionality provided by Spring JMX. Internally StopWatch simply runs a task that increments the
value of its 'seconds' attribute by 1 every second.
JMX Attribute Polling Channel Adapter simply polls a managed attribute 'Seconds' of the StopWatch MBean identified by the 'org.springframework.integration.samples.jmx:type=StopWatch,name=stopWatch' name and sends its value to a 'seconds' channel.
The interesting this is that 'seconds' channel is a publish-subscribe-channel and has two subscribers;
- Stdout Channel Adapter which prints the value of the polled attribute to the console;
- Filter which essentially waits till payload value is 10;
Once the payload value is 10 filter sends the Message to a 'reset' channel which is represented as JMX Operation Invoking Channel Adapter
which simply invokes 'reset' operation on the same StopWatch MBean resetting 'Seconds' attribute value back to 1 and the process repeats.
To run JMX Adapter sample simple execute JmxAdapterDemoTest
You will see the output similar to this which will loop for ~ 20 sec:
1
2
3
4
5
6
7
8
9
10
1
2
3
. . .

33
basic/mail/README.md Normal file
View File

@@ -0,0 +1,33 @@
Mail sample
===========
This example demonstrates the following aspects of the Mail support available with Spring Integration:
1. IMAP IDLE Inbound Channel Adapter (with sample GMail configuration)
2. POP3 Inbound Channel Adapter (with sample GMail configuration)
Simply change configuration file (src/main/resources/META-INF/spring/integration/**gmail-imap-idle-config.xml** or **gmail-pop3-config.xml**) to point to your existing GMail account (replace userid and password) and run:
* GmailInboundImapIdleAdapterTest.java - for IMAP IDLE sample
* GmailInboundPop3AdapterTest - for POP3 sample
**IMPORTANT**: You must enable POP3/IMAP access for your google account (follow **Settings** link on your GMail page).
Once started, start sending emails to your account. You'll see that adapter will receive messages and will publish them to a channel specified by 'channel' attribute.
You should see the output similar to this:
DEBUG: org.springframework.integration.mail.ImapMailReceiver - connecting to store [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
INFO : org.springframework.integration.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX]
Send a Message and you will see:
DEBUG: org.springframework.integration.mail.ImapMailReceiver - found 2 new messages
DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - received 2 mail messages
INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@1f00aff5][Headers={$timestamp=1284745370451, $id=9dfd4b30-2d15-4905-9301-f39aa4073ea0}]
INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@66200db9][Headers={$timestamp=1284745370452, $id=4b8322ba-f469-4afc-af4f-1332a94b735b}]
DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - waiting for mail
DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
You can experiment with various attributes of the adapter (e.g., should-delete-messages, should-mark-messages-as-read etc...)

View File

@@ -1,33 +0,0 @@
This example demonstrates the following aspects of the Mail support available with Spring Integration:
1. IMAP IDLE Inbound Channel Adapter (with sample GMail configuration)
2. POP3 Inbound Channel Adapter (with sample GMail configuration)
Simply change configuration file (src/main/resources/META-INF/spring/integration/gmail-imap-idle-config.xml or gmail-pop3-config.xml)
to point to your existing GMail account (replace userid and password) and run:
GmailInboundImapIdleAdapterTest.java - for IMAP IDLE sample
GmailInboundPop3AdapterTest - for POP3 sample
IMPORTANT: You must enable POP3/IMAP access for your google account (follow "Settings" link on your GMail page).
Once started start sending emails to your account. You'll see that adapter will receive messages and will
publish them to a channel specified by 'channel' attribute.
Make sure you enable your GMail account for IMAP/POP3 access.
You should see the output similar to this:
DEBUG: org.springframework.integration.mail.ImapMailReceiver - connecting to store [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
INFO : org.springframework.integration.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX]
Send a Message and you will see:
DEBUG: org.springframework.integration.mail.ImapMailReceiver - found 2 new messages
DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - received 2 mail messages
INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@1f00aff5][Headers={$timestamp=1284745370451, $id=9dfd4b30-2d15-4905-9301-f39aa4073ea0}]
INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@66200db9][Headers={$timestamp=1284745370452, $id=4b8322ba-f469-4afc-af4f-1332a94b735b}]
DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - waiting for mail
DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://<your_user_name>:*****@imap.gmail.com:993/inbox]
You can experiment with various attributes of the adapter (e.g., should-delete-messages, should-mark-messages-as-read etc...)

View File

@@ -1,15 +1,16 @@
Odd Even Sample
===============
This example demonstrates the following aspects of the CORE EIP support available with Spring Integration:
1. Inbound Channel Adapter
2. Filter
3. Router (SpEL based)
4. Poller with Cron and Interval Trigers
Messages are simply being emitted by the Poller (interval based or cron) triggering 'next()' method of Counter class and
sent to a 'numbers' channel - Inbound Channel Adapter. From the 'numbers' channel Messages are sent
to an expression-based router (Spring Expression Language). ALl that router does is simply routing messages
to OddLogger and EvenLogger service
Messages are simply being emitted by the Poller (interval based or cron) triggering '**next()**' method of Counter class and sent to a '**numbers**' channel - Inbound Channel Adapter. From the '**numbers**' channel Messages are sent to an expression-based router (Spring Expression Language). All that the router does is simply routing messages to *OddLogger* and *EvenLogger* service
To execute the Interval-based sample simply run IntervalOddEvenDemoTest class and for Cron-based sample simply
To execute the Interval-based sample simply run **IntervalOddEvenDemoTest** class and for Cron-based sample simply
run CronOddEvenDemo class, You should see the output similar to this:
INFO : org.springframework.integration.samples.oddeven.OddLogger - odd: 1 at 2010-09-16 05:55:46

28
basic/quote/README.md Normal file
View File

@@ -0,0 +1,28 @@
Quote Sample
============
This example demonstrates the following aspects of the CORE EIP support available with Spring Integration:
1. Channel Adapter (Inbound and Stdout)
2. Poller with Interval Trigers
3. Service Activator
It is a very simple example that introduces you to the Channel adapters and Pollers.
Messages are simply being emitted by the Poller (interval based) triggering **nextTicker()** method of *TickerStream* class and sent to a **tickers** channel from which they are retrieved by the *TickerStream* service.
*TickerStream* service generates random ticker symbols sending them to the **quotes** channel from which they are retrieved by the *QuoteService* (annotation based Service Activator). *QuoteService* generates random quotes sending them to the *Stdout Channel Adapter* where they are printed to a console.
To execute sample simply run **QuoteDemoTest**. You should see the output similar to this:
XNY: 90.03
XMR: 17.11
IWR: 35.85
KHR: 54.43
WUW: 95.29
YYC: 7.44
DYW: 84.76
TIW: 28.31
HGE: 28.90

View File

@@ -1,24 +0,0 @@
This example demonstrates the following aspects of the CORE EIP support available with Spring Integration:
1. Channel Adapter (Inbound and Stdout)
2. Poller with Interval Trigers
3. Service Activator
A very simple example that introduces you to the Channel adapters and Pollers.
Messages are simply being emitted by the Poller (interval based) triggering 'nextTicker()' method of TickerStream class and
sent to a 'tickers' channel from which they are retrieved by the TickerStream service. TockerStream service generates random
ticker symbols sending them to the 'quotes' channel from which they are retrieved by the QuoteService (annotation based Service Activator).
QuoteService generates random quotes sending them to the Stdout Channel Adapter where they are printed to a console.
To execute sample simply run QuoteDemoTest. You should see the output similar to this:
XNY: 90.03
XMR: 17.11
IWR: 35.85
KHR: 54.43
WUW: 95.29
YYC: 7.44
DYW: 84.76
TIW: 28.31
HGE: 28.90

71
basic/sftp/README.md Normal file
View File

@@ -0,0 +1,71 @@
SFTP Sample
===========
This example demonstrates the following aspects of the SFTP support available with Spring Integration:
1. SFTP Inbound Channel Adapter (transfers files from remote to local directory)
2. SFTP Outbound Channel Adapter (transfers files from local to the remote directory)
In order to run this sample you need to:
1. generate private/public keys. Below is simple directions what needs to be done
2. update user.properties file with appropriate values
3. run the sample
## INBOUND CHANNEL ADAPTER
To run the NBOUND CHANNEL ADAPTER sample execute **SftpInboundReceiveSample** test. You will see that based on configuration it will access the sample remote directory which contains 3 files and will attempt to securely copy them to a local directory which will be generated. The output should look like this:
Received first file message: [Payload=local-dir/a.txt][Headers={timestamp=1290066001349, id=9dca686a-cfd4-4d96-a1a7-761feb005e43}]
Received second file message: [Payload=local-dir/b.txt][Headers={timestamp=1290066001650, id=d33a475d-fa71-4c5b-b73e-3147969f1c6f}]
No third file was received null
As you can see, although the remote directory had 3 files we only received 2 since we were filtering only the files that end with **txt**.
## OUTBOUND CHANNEL ADAPTER
To run the OUTBOUND CHANNEL ADAPTER sample execute the **SftpOutboundTransferSample** test. You will see that based on the configuration it will attempt to transfer this **readme.txt** file to a remote directory **remote-target-dir**. The output should look like this:
Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt_foo'
NOTE: You can see that we are using *SpEL* via the **remote-filename-generator-expression** attribute to define the remote file name by simply appending **_foo** to the original file name.
## OUTBOUND GATEWAY
Run the **FtpOutoundGateway** sample as a JUnit test; it creates 2 files, retrieves and removes them over ftp. It cleans up by removing the retrieved files. The test assumes full access to the filesystem via **/tmp** where the test files are created. Requires **sshd** to be running on localhost.
This sample uses a property **private.keyfile** to point to the location of your private key. Requires setting of **user**, **private.keyfile** and, optionally, **passphrase** in **user.properties**.
### HOW TO GENERATE KEYS
>$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/ozhurakousky/.ssh/id_rsa): ./sftp_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ./sftp_rsa.
Your public key has been saved in ./sftp_rsa.pub.
The key fingerprint is:
2c:30:7c:18:3c:a0:d5:83:68:78:7e:c1:5f:c1:3e:3d ozhurakousky@oleg.home
The key's randomart image is:
+--[ RSA 2048]----+
|..o*. ... |
|o+o.Bo o |
|oo ==.o . |
| . .+..o E |
| . . S. . |
| . |
| |
| |
| |
+-----------------+
>$ ls
sftp_rsa sftp_rsa.pub
>$
* Create a file ~/.ssh/authorized_keys and give it the required permissions
>$ chmod 600 ~/.ssh/authorized_keys
* Then edit **authorized_keys** file and paste in the contents of the public key file **sftp_rsa.pub**.
* Move your private key file **sftp_rsa** to META-INF/keys directory

View File

@@ -1,79 +0,0 @@
This example demonstrates the following aspects of the SFTP support available with Spring Integration:
1. SFTP Inbound Channel Adapter (transfers files from remote to local directory)
2. SFTP Outbound Channel Adapter (transfers files from local to the remote directory)
In order to run this sample you need to
1. generate private/public keys. Below is simple directions what needs to be done
2. update user.properties file with appropriate values
3. run the sample
#### INBOUND CHANNEL ADAPTER ####
To run INBOUND CHANNEL ADAPTER sample execute SftpInboundReceiveSample test. You will see that based on configuration it
will access sample remote directory which contains 3 files and will attept to securly copy them to a local directory which
will be generated.
The output should look like this:
=====
Received first file message: [Payload=local-dir/a.txt][Headers={timestamp=1290066001349, id=9dca686a-cfd4-4d96-a1a7-761feb005e43}]
Received second file message: [Payload=local-dir/b.txt][Headers={timestamp=1290066001650, id=d33a475d-fa71-4c5b-b73e-3147969f1c6f}]
No third file was received null
=====
As you can see, although the remote directory had 3 files we only received 2 since we were filtering only the files that end with 'txt'.
#### OUTBOUND CHANNEL ADAPTER ####
To run OUTBOUND CHANNEL ADAPTER sample execute SftpOutboundTransferSample test. You will see that based on configuration it
will attempt to transfer this 'readme.txt' file to a remote directory 'remote-target-dir'
The output should look like this:
=====
Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt_foo'
=====
NOTE: You can see that we are using SpEL via 'remote-filename-generator-expression' attribute to define the remote file name by
simply appending '_foo' to the original file name.
#### OUTBOUND GATEWAY ####
Run the FtpOutoundGateway sample as a JUnit test; it creates 2 files, retrieves and removes them over ftp. It cleans up
by removing the retrieved files. Test assumes full access to the filesystem via /tmp where the test files are created.
Requires sshd to be running on localhost.
This sample uses a property 'private.keyfile' to point to the location of your private key.
Requires setting of user, private.keyfile and, optionally, passphrase in user.properties.
====== HOW TO GENERATE KEYS ======
>$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/ozhurakousky/.ssh/id_rsa): ./sftp_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ./sftp_rsa.
Your public key has been saved in ./sftp_rsa.pub.
The key fingerprint is:
2c:30:7c:18:3c:a0:d5:83:68:78:7e:c1:5f:c1:3e:3d ozhurakousky@oleg.home
The key's randomart image is:
+--[ RSA 2048]----+
|..o*. ... |
|o+o.Bo o |
|oo ==.o . |
| . .+..o E |
| . . S. . |
| . |
| |
| |
| |
+-----------------+
>$ ls
sftp_rsa sftp_rsa.pub
>$
2. Create a file ~/.ssh/authorized_keys and give it the required permissions
>$ chmod 600 ~/.ssh/authorized_keys
3. Then edit 'authorized_keys' file and paste in the contents of the public key file 'sftp_rsa.pub' .
4. Move your private key file 'sftp_rsa' to META-INF/keys directory

View File

@@ -0,0 +1,49 @@
TCP Sample
==========
This is a place to get started with the Transmission Control Protocol (TCP). It demonstrates a simple message flow represented by the diagram below:
Gateway -> Channel -> TcpOutboundGateway -> <===Socket===> -> TcpInboundGateway -> Channel -> ServiceActivator
The service returns a response which the inbound gateway sends back over the socket to the outbound gateway and the result is returned to the client that invoked the original SimpleGateway method.
To run sample simply execute a test case in **org.springframework.integration.samples.tcpclientservice** package.
Note that the test case includes an alternative configuration that uses the in-built conversion service and the channel dataType attribute, instead of explicit transformers, to convert from byte arrays to Strings.
Simply change the @ContextConfiguration to switch between the two techniques. In addition, a simple telnet server is provided; see **TelnetServer** in src/main/java. Run this class as a Java application and then use telnet to connect to the service (**telnet localhost 11111**).
Messages sent will be returned, preceded by 'echo:'.
$ telnet localhost 11111
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello world!
echo:Hello world!
Test
echo:Test
^]
telnet> quit
Connection closed.
Note that the test case also demonstrates error handling on an inbound gateway using direct channels. If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured with an error-channel attribute. Messages sent to that channel are consumed by a transformer that concatenates the inbound message payload with the message text from the thrown exception, returning **FAIL:Failure Demonstration** over the TCP socket.
This can also be demonstrated with the telnet client thus...
$ telnet localhost 11111
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello world!
echo:Hello world!
FAIL
FAIL:Failure Demonstration
Hello
echo:Hello
^]
telnet> quit
Connection closed.

View File

@@ -1,58 +0,0 @@
This is a place to get started with tcp. It demonstrates a simple message flow represented by the diagram below:
Gateway -> Channel -> TcpOutboundGateway -> <===Socket===> -> TcpInboundGateway -> Channel -> ServiceActivator
The service returns a response which the inbound gateway sends back over the socket to the outbound gateway
and the result is returned to the client that invoked the original SimpleGateway method.
To run sample simply execute a test case in org.springframework.integration.samples.tcpclientservice package.
Note that the test case includes an alternative configuration that uses the in-built conversion service
and the channel dataType attribute, instead of explicit transformers, to convert from byte arrays to Strings.
Simply change the @ContextConfiguration to switch between the two techniques.
In addition, a simple telnet server is provided; see TelnetServer in src/main/java. Run this class as a
java application and then use telnet to connect to the service ('telnet localhost 11111').
Messages sent will be returned, preceded by 'echo:'.
$ telnet localhost 11111
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello world!
echo:Hello world!
Test
echo:Test
^]
telnet> quit
Connection closed.
Note that the test case also demonstrates error handling on an inbound gateway using direct channels.
If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured
with an error-channel attribute. Messages sent to that channel are consumed by a transformer
that concatenates the inbound message payload with the message text from the thrown
exception, returning 'FAIL:Failure Demonstration' over the TCP socket.
This can also be demonstrated with the telnet client thus...
$ telnet localhost 11111
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello world!
echo:Hello world!
FAIL
FAIL:Failure Demonstration
Hello
echo:Hello
^]
telnet> quit
Connection closed.

View File

@@ -0,0 +1,41 @@
Testing Examples
================
A series of test cases that show techniques to test Spring Integration applications.
## ...chain.SpelChainTests.java
This test case shows how to test a fragment of a larger integration flow. In this example, we have a simple chain containing a header enricher and a transformer. It uses Direct channels. The test case shows how to bridge the output channel to a queue channel so we can retrieve the output message after the test executes and verify the appropriate actions were applied to the input message.
## ...splitter.CommaDelimitedSplitterTests.java
This test case shows both unit testing a custom splitter class as well as testing it within a Spring Integration flow fragment.
## ...aggregator.CommaDelimitedAggregatorTests.java
This test case shows both unit testing a custom aggregator class as well as testing it within a Spring Integration flow fragment.
## ...externalgateway.ExternalGatewaySubstitutionTests.java
This example is a little more complex. The application is a simplified version of a travel demo presented at SpringOne in 2010. You do not need to fully understand the application for the purposes of this demonstration. Suffice it to say that a zip (postal) code is sent to two outbound gateways (one web service, one http) and the weather and traffic for that zip code are aggregated together. You can run the "real" application by executing the Main class in src/main/java and entering a valid zip code in the console.
In many cases, when integrating with external services, we can't rely on those services being available while we test. Consequently, we need a mechanism to stub out those services so we can run the remainder of the flow in a repeatable manner without need for connectivity to the services. This example uses dummy service activators in place of the real outbound gateways.
This separation of 'infrastructure' from application beans is similar to the way we separate *DataSource*, *ConnectionFactory* beans etc so that the application can be tested with local versions.
## ...router.PetRouterTests.java
This test case shows both unit testing a custom router class as well as testing it within a Spring Integration flow fragment. A second filter is defined, that uses a discard channel for filtered messages.
## ...filter.PetFilterTests.java
This test case shows both unit testing a custom filter class as well as testing it within a Spring Integration flow fragment.
## ...gateway.GatewayTests.java
This test case shows how to verify that a <gateway/> has been configured to work as expected, including @Header parameters on the gateway method and <method/> elements in the configuration.
## ...errorhandling.GatewayTests.java
This test case shows how to verify that gateway error-channel configuration is correct, and show how to extract the cause and failed message from the MessagingException.

View File

@@ -1,77 +0,0 @@
A series of test cases that show techniques to test Spring Integration applications.
Examples
========
...chain.SpelChainTests.java
This test case shows how to test a fragment of a larger integration flow.
In this example, we have a simple chain containing a header enricher and
a transformer. It uses Direct channels. The test case shows how to
bridge the output channel to a queue channel so we can retrieve the
output message after the test executes and verify the appropriate
actions were applied to the input message.
...splitter.CommaDelimitedSplitterTests.java
This test case shows both unit testing a custom splitter class as well
as testing it within a Spring Integration flow fragment.
...aggregator.CommaDelimitedAggregatorTests.java
This test case shows both unit testing a custom aggregator class as well
as testing it within a Spring Integration flow fragment.
...externalgateway.ExternalGatewaySubstitutionTests.java
This example is a little more complex. The application is simplified version of a
travel demo presented at SpringOne in 2010. You do not need to fully understand
the application for the purposes of this demonstration. Suffice it to
say that a zip code is sent to two outbound gateways (one web service, one http) and
the weather and traffic for that zip code are aggregated together. You
can run the "real" application by executing the Main class in src/main/java
and entering a valid zip code in the console.
In many cases, when integrating with external services, we can't rely on
those services being available while we test. Consequently, we need a
mechanism to stub out those services so we can run the remainder of the
flow in a repeatable manner without need for connectivity to the services.
This example uses dummy service activators in place of the real outbound
gateways.
This separation of 'infrastructure' from application beans is similar to
the way we separate DataSource, ConnectionFactory beans etc so that the
application can be tested with local versions.
...router.PetRouterTests.java
This test case shows both unit testing a custom router class as well
as testing it within a Spring Integration flow fragment.
A second filter is defined, that uses a discard channel for filtered
messages.
...filter.PetFilterTests.java
This test case shows both unit testing a custom filter class as well
as testing it within a Spring Integration flow fragment.
...gateway.GatewayTests.java
This test case shows how to verify that a <gateway/> has been configured
to work as expected, including @Header parameters on the gateway method
and <method/> elements in the configuration.
...errorhandling.GatewayTests.java
This test case shows how to verify that gateway error-channel configuration
is correct, and show how to extract the cause and failed message from
the MessagingException.

36
basic/twitter/README.md Normal file
View File

@@ -0,0 +1,36 @@
Twitter Sample
==============
This example demonstrates the following aspects of the Twitter support available with Spring Integration:
1. Twitter Inbound Channel Adapter - allows you to receive HOME status updates
2. Twitter Inbound Search Channel Adapter - allows you to receive HOME status updates
3. Twitter Outboud Channel Adapter - allows send status updates
In order to run this sample you need to configure OAuth and set the values in the OAuth properties.
To use OAuth authentication/authorization with Twitter you must create new Application on Twitter Developers site.
Follow the directions below to create a new application and obtain consumer keys and access token:
* Go to http://dev.twitter.com/
* Click on 'Register an app' link and fill out all required fields on the form provided;
* Set 'Application Type' to 'Client' and depending on the nature of your application
* Select 'Default Access Type' as 'Read & Write' or 'Read-only'
* Submit the form.
* If everything is successful you'll be presented with the 'Consumer Key' and 'Consumer Secret'.
* Copy both values in the safe place.
* On the same page you should see 'My Access Token' button on the side bar (right).
* Click on it and you'll be presented with two more values: 'Access Token' and 'Access Token Secret'.
* Copy these values in a safe place as well.
When done fill out **oauth.properties** file so it looks similar to this.
twitter.oauth.consumerKey=4XzBPabcJQxyBzzzH3TrRQ
twitter.oauth.consumerSecret=ab2piKdMfPu8bVa3ab6DAIvIWEVZyMDL0RSEN2I8
twitter.oauth.accessToken=21691649-4XYZY5iJEOfz2A9qCFd9SjBRGb3HLmIm4HNE6AMv4
twitter.oauth.accessTokenSecret=AbRxUAvyNCtqQtvxFK8w5ZMtMj20KFhB6oEfTA0
NOTE: the above values are not real ;)
Now you ready to execute samples. Just run each sample and look for the output produced by the inbound adapters (**TwitterSearchSample.java** and **TwitterTimelineUpdateSample.java**)
The outbound adapter sample (**TwitterSendUpdatesSample.java**) will not produce any output. Instead within seconds you should see your tweet.

View File

@@ -1,36 +0,0 @@
This example demonstrates the following aspects of the Twitter support available with Spring Integration:
1. Twitter Inbound Channel Adapter - allows you to receive HOME status updates
2. Twitter Inbound Search Channel Adapter - allows you to receive HOME status updates
3. Twitter Outboud Channel Adapter - allows send status updates
In order to run this sample you need to configure OAuth and set the values in the OAuth properties.
================
To use OAuth authentication/authorization with Twitter you must create new Application on Twitter Developers site.
Follow the directions below to create a new application and obtain consumer keys and access token:
- Go to http://dev.twitter.com/
- Click on 'Register an app' link and fill out all required fields on the form provided;
- Set 'Application Type' to 'Client' and depending on the nature of your application select
'Default Access Type' as 'Read & Write' or 'Read-only' and Submit the form.
- If everything is successful you'll be presented with the 'Consumer Key' and 'Consumer Secret'.
- Copy both values in the safe place.
On the same page you should see 'My Access Token' button on the side bar (right).
- Click on it and you'll be presented with two more values: 'Access Token' and 'Access Token Secret'.
Copy these values in a safe place as well.
When done fill out oauth.properties file so it looks similar to this.
twitter.oauth.consumerKey=4XzBPabcJQxyBzzzH3TrRQ
twitter.oauth.consumerSecret=ab2piKdMfPu8bVa3ab6DAIvIWEVZyMDL0RSEN2I8
twitter.oauth.accessToken=21691649-4XYZY5iJEOfz2A9qCFd9SjBRGb3HLmIm4HNE6AMv4
twitter.oauth.accessTokenSecret=AbRxUAvyNCtqQtvxFK8w5ZMtMj20KFhB6oEfTA0
NOTE: the above values are not real ;)
=======================
Now you ready to execute samples. Just run each sample and look for the output produced by the
inbound adapters (TwitterSearchSample.java and TwitterTimelineUpdateSample.java)
The outbound adapter sample (TwitterSendUpdatesSample.java) will not produce any output.
Instead within seconds you should see your tweet.

View File

@@ -0,0 +1,13 @@
Web Service Inbound Gateway Sample
==================================
This sample demonstrates a barebones *inbound Web Service Gateway*. Take a look at **web.xml** in the WEB-INF directory where the Spring Web Services Message-dispatching Servlet is defined. Then have a look at the **spring-ws-config.xml** file (also in the WEB-INF directory) where the Spring WS EndpointMapping is defined. Finally view the Spring Integration configuration in the **inbound-gateway-config.xml** file within the **org.springframework.integration.samples.ws** package where the actual gateway is defined along with a channel and service-activator.
To use the gateway, you can run the tests that are located within the **src/test/java** directory. One is for standalone testing of the gateway itself, while the other tests the gateway running on a web server. The latter uses Spring Web Services' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be POSTed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">hello</echoRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

View File

@@ -1,10 +0,0 @@
This sample demonstrates a barebones inbound Web Service Gateway. Take a look at "web.xml" in the WEB-INF directory where the Spring Web Services Message-dispatching Servlet is defined. Then have a look at the "spring-ws-config.xml" file (also in the WEB-INF directory) where the Spring WS EndpointMapping is defined. Finally view the Spring Integration configuration in the "inbound-gateway-config.xml" file within the "org.springframework.integration.samples.ws" package where the actual gateway is defined along with a channel and service-activator.
To use the gateway, you can run the tests that are located within the "src/test/java" directory. One is for standalone testing of the gateway itself, while the other tests the gateway running on a web server. The latter uses Spring Web Services' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be POSTed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">hello</echoRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

View File

@@ -0,0 +1,17 @@
WS Outbound Gateway Sample
==========================
This example demonstrates the following aspects of the WS support available with Spring Integration:
1. WS Outbound Gateway
2. Content Enricher
3. Composed Message Processor
A very simple example that show you how easy it is to invoke a SOAP based service using Spring Integration.
* A Message is simply sent to a channel, where it is retrieved by a *Chain* which consists of a *Header Enricher* and a *WS Outbound Gateway*.
* The *Header Enricher* enriches the Message with the SOAP action header.
* The *WS Outbound Gateway* converts the Message to a SOAP request and sends it to a remote service, which converts a temperature from
Fahrenheit to Celsius and the result is printed to the console.
To run sample simply execute **WebServicesDemoTest**

View File

@@ -1,15 +0,0 @@
This example demonstrates the following aspects of the WS support available with Spring Integration:
1. WS Outbound Gateway
as well as:
2. Content Enricher
3. Composed Message Processor
A very simple example that show you how easy it is to invoke a SOAP based service using Spring Integration
Message is simply sent to a channel where it is retrieved by a Chain which consists of Header Enricher and WS Outbound Gateway
Header Enricher enriches Message with the SOAP action header
WS Outbound Gateway converts Message to a SOAP request and sends it to a remote service which converts temperature from
Fahrenheit to Celsius and sent back where the result is printed to a console.
To run sample simply execute WebServicesDemoTest

30
basic/xml/README.md Normal file
View File

@@ -0,0 +1,30 @@
XML Sample
==========
This example demonstrates the following aspects of the XML support available with Spring Integration:
1. XPath Splitter - to split an order with multiple items into several order messages for separate processing.
2. XPath Router - to route messages according to the evaluation of an XPath expression which tests to see if the order item is in stock.
3. XPath Expression - which tests to see if the order item is in stock
3. XSLT Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
To run sample simply execute **BookOrderProcessingTest**. You should see the following output:
INFO : org.springframework.integration.samples.xml.WarehouseDispatch - Warehouse dispatching orderItem:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<orderItem in-stock="true" xmlns="http://www.example.org/orders">
<isbn>0321200683</isbn>
<quantity>2</quantity>
</orderItem>
INFO : org.springframework.integration.samples.xml.ExternalResupply - Placing resupply order:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<bb:bigBooksOrder xmlns:bb="http://www.example.org/orders-bigbooks"
xmlns:sb="http://www.example.org/orders">
<bb:order>
<bb:purchaser>smallbooks</bb:purchaser>
<bb:quantity>5</bb:quantity>
<bb:isbn>1590596439</bb:isbn>
</bb:order>
</bb:bigBooksOrder>

View File

@@ -1,25 +0,0 @@
This example demonstrates the following aspects of the XML support available with Spring Integration:
1. XPath Splitter - to split an order with multiple items into several order messages for separate processing.
2. XPath Router - to route messages according to the evaluation of an XPath expression which tests to see if the order item is in stock.
3. XPath Expression - which tests to see if the order item is in stock
3. XSLT Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
To run sample simply execute BookOrderProcessingTest. You should see the following output:
INFO : org.springframework.integration.samples.xml.WarehouseDispatch - Warehouse dispatching orderItem:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<orderItem in-stock="true" xmlns="http://www.example.org/orders">
<isbn>0321200683</isbn>
<quantity>2</quantity>
</orderItem>
INFO : org.springframework.integration.samples.xml.ExternalResupply - Placing resupply order:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<bb:bigBooksOrder xmlns:bb="http://www.example.org/orders-bigbooks"
xmlns:sb="http://www.example.org/orders">
<bb:order>
<bb:purchaser>smallbooks</bb:purchaser>
<bb:quantity>5</bb:quantity>
<bb:isbn>1590596439</bb:isbn>
</bb:order>
</bb:bigBooksOrder>

19
basic/xmpp/README.md Normal file
View File

@@ -0,0 +1,19 @@
XMPP Sample
===========
This example was prepared for testing with GoogleTalk and demonstrates the following aspects of the *Extensible Messaging and Presence Protocol* (XMPP) support available with Spring Integration:
1. XMPP Inbound Channel Adapter - receive instant messages.
2. XMPP Outboud Channel Adapter - send instant messages.
In order to run this sample you need to provide correct values in **xmpp.properties**.
Everything there was already preset. The only 3 properties you need to provide values for are:
* user.login
* user.password
* send.to.user
You'll also need to test it with your friend or have two Google accounts setup.
To test **SendInstantMessageSample.java**, first log on to the account identified via **send.to.user** property and make sure that that account is in your buddy list. Then run the demo.
To test **ReceiveInstantMessageSample.java**, first log on to the account identified via **send.to.user** property. Then run the demo. When demo class is started you'll see on GoggleTalk that your buddy (ReceiveInstantMessageSample.java) has just signed on. Now you can send a message from GoogleTalk and see it appear ion the console.

View File

@@ -1,21 +0,0 @@
This example was prepared for testing with GoogleTalk and
demonstrates the following aspects of the XMPP support available with Spring Integration:
1. XMPP Inbound Channel Adapter - receive instant messages.
2. XMPP Outboud Channel Adapter - send instant messages.
In order to run this sample you need to provide correct values in xmpp.properties.
Everything there was already preset. The only 3 properties you need to provide values for are:
- user.login
- user.password
- send.to.user
You'll also need to test it with your friend or have two Google accounts setup
To test SendInstantMessageSample.java, first log on to the account identified via 'send.to.user' property
and make sure that that account is in your buddy list. Then run the demo.
To test ReceiveInstantMessageSample.java, first log on to the account identified via 'send.to.user' property.
Then run the demo. When demo class is started you'll see on GoggleTalk that your buddy (ReceiveInstantMessageSample.java)
has just signed on. Now you can send a message from GoogleTalk and see it appear ion the console.