diff --git a/README.md b/README.md
index b567ab72..13066afa 100644
--- a/README.md
+++ b/README.md
@@ -68,6 +68,7 @@ This category targets developers who are already more familiar with the Spring I
* **tcp-client-server-multiplex** - Demonstrates the use of *Collaborating Channel Adapters*
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
+* **stored-procedures-postgresql** Provides an example of the stored procedure Outbound Gateway using *[PostgreSQL](http://www.postgresql.org/)*
* **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.
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
diff --git a/intermediate/stored-procedures-postgresql/README.md b/intermediate/stored-procedures-postgresql/README.md
new file mode 100644
index 00000000..4be737c8
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/README.md
@@ -0,0 +1,93 @@
+Spring Integration - Stored Procedure Example - PostgreSQL
+================================================================================
+
+# Overview
+
+This example provides a simple example using the *Stored Procedure Outbound Gateway*
+adapter. This example will call 1 PostgreSQL **Stored Function** and 1 **Stored Procedure**.
+
+The second procedure returns a **ResultSet**.
+
+# Setup
+
+## Maven
+
+Please make sure you have *Maven* set up and that the project builds successfully using `mvn clean package`.
+
+## PostgreSQL
+
+Please ensure that you can connect to a running instance of a *PostgreSQL server*. The sample was tested using **PostgreSQL v9.2.1**.
+
+### Required Table
+
+```SQL
+CREATE TABLE "COFFEE_BEVERAGES"
+(
+ "ID" integer NOT NULL,
+ "COFFEE_NAME" text,
+ "COFFEE_DESCRIPTION" text,
+ CONSTRAINT "COFFEE_BEVERAGES_pkey" PRIMARY KEY ("ID")
+)
+```
+
+### Sample Data
+
+```SQL
+INSERT INTO "COFFEE_BEVERAGES" ("ID", "COFFEE_NAME", "COFFEE_DESCRIPTION") VALUES (1, 'Espresso', 'Espressos keep developers going in the morning. There are never enough of them.');
+INSERT INTO "COFFEE_BEVERAGES" ("ID", "COFFEE_NAME", "COFFEE_DESCRIPTION") VALUES (2, 'Cappuccino', 'For the finer moments. Wrap your espresso in a tasty layer of foam.');
+INSERT INTO "COFFEE_BEVERAGES" ("ID", "COFFEE_NAME", "COFFEE_DESCRIPTION") VALUES (3, 'Mocha', 'Mmmmh, chocolate.');
+INSERT INTO "COFFEE_BEVERAGES" ("ID", "COFFEE_NAME", "COFFEE_DESCRIPTION") VALUES (4, 'Latte', 'If you are more into milk than into foam.');
+```
+
+### Stored Procedures
+
+Please create the following Stored Procedure/Function:
+
+```SQL
+CREATE OR REPLACE FUNCTION find_all_coffee_beverages()
+ RETURNS refcursor AS
+$BODY$
+DECLARE
+ ref refcursor;
+BEGIN
+ OPEN ref FOR SELECT "ID", "COFFEE_NAME", "COFFEE_DESCRIPTION" FROM "COFFEE_BEVERAGES";
+ RETURN ref;
+END;
+$BODY$
+LANGUAGE plpgsql VOLATILE
+COST 100;
+```
+
+```SQL
+CREATE OR REPLACE FUNCTION find_coffee(coffee_name integer)
+ RETURNS character varying AS
+$BODY$
+declare
+ description character varying;
+begin
+ SELECT into description "COFFEE_DESCRIPTION" from "COFFEE_BEVERAGES" where "ID"=coffee_name;
+ return description;
+end
+$BODY$
+LANGUAGE plpgsql VOLATILE
+COST 100;
+```
+### Configure the DataSource
+
+Please configure the necessary credentials in order to connect to your database in **/src/main/resources/META-INF/spring/integration/spring-integration-context.xml**. The default setting expects a database **integration** to run on localhost with a usersname of **postgres** and a password of **postgres**.
+
+# Run the Sample
+
+* running the "Main" class from within STS (Right-click on Main class --> Run As --> Java Application)
+* or from the command line:
+ - mvn package
+ - mvn exec:java
+
+* Follow the screen (command line) instructions.
+
+--------------------------------------------------------------------------------
+
+For help please take a look at the Spring Integration documentation:
+
+http://www.springsource.org/spring-integration
+
diff --git a/intermediate/stored-procedures-postgresql/pom.xml b/intermediate/stored-procedures-postgresql/pom.xml
new file mode 100644
index 00000000..69273e37
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/pom.xml
@@ -0,0 +1,112 @@
+
+ 4.0.0
+
+ org.springframework.integration.samples
+ postgresql-stored-procedures
+ 2.2.0.BUILD-SNAPSHOT
+ jar
+
+ Samples (Intermediate) - Stored Procedures PostgreSQL
+ http://www.springsource.org/spring-integration
+
+
+ 2.2.1
+
+
+
+ UTF-8
+ 2.2.0.RC2
+ 1.2.17
+ 4.10
+
+
+
+
+ repo.springsource.org.milestone
+ SpringSource Maven Milestone Repository
+ https://repo.springsource.org/libs-milestone
+
+
+
+
+
+
+ maven-eclipse-plugin
+ 2.9
+
+
+ org.springframework.ide.eclipse.core.springnature
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+ true
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.5.1
+
+ 1.6
+ 1.6
+ -Xlint:all
+ true
+ true
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+ org.springframework.integration.Main
+
+
+
+
+
+
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+
+
+
+ org.springframework.integration
+ spring-integration-jdbc
+ ${spring.integration.version}
+
+
+
+
+
+ log4j
+ log4j
+ ${log4j.version}
+
+
+
+
+
+ postgresql
+ postgresql
+ 9.1-901-1.jdbc4
+
+
+
+ commons-dbcp
+ commons-dbcp
+ 1.4
+
+
+
diff --git a/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/Main.java b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/Main.java
new file mode 100644
index 00000000..0a299579
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/Main.java
@@ -0,0 +1,106 @@
+/*
+ * 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;
+
+import java.util.List;
+import java.util.Scanner;
+
+import org.apache.log4j.Logger;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import org.springframework.integration.model.CoffeeBeverage;
+import org.springframework.integration.service.CoffeeService;
+
+
+/**
+ * Starts the Spring Context and will initialize the Spring Integration routes.
+ *
+ * @author Gunnar Hillert
+ * @since 2.2
+ *
+ */
+public final class Main {
+
+ private static final Logger LOGGER = Logger.getLogger(Main.class);
+
+ private static final String LINE = "\n=========================================================";
+ private static final String NEWLINE = "\n";
+
+ private Main() { }
+
+ /**
+ * Load the Spring Integration Application Context
+ *
+ * @param args - command line arguments
+ */
+ public static void main(final String... args) {
+
+ LOGGER.info(LINE
+ + LINE
+ + "\n Welcome to Spring Integration Coffee Database! "
+ + NEWLINE
+ + "\n For more information please visit: "
+ + "\n http://www.springsource.org/spring-integration "
+ + NEWLINE
+ + LINE );
+
+ final AbstractApplicationContext context =
+ new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml");
+
+ context.registerShutdownHook();
+
+ final Scanner scanner = new Scanner(System.in);
+
+ final CoffeeService service = context.getBean(CoffeeService.class);
+
+ LOGGER.info(LINE
+ + NEWLINE
+ + "\n Please press 'q + Enter' to quit the application."
+ + NEWLINE
+ + LINE);
+
+ System.out.print("Please enter 'list' and press to get a list of coffees.");
+ System.out.print("Enter a coffee id, e.g. '1' and press to get a description.\n\n");
+
+ while (!scanner.hasNext("q")) {
+
+ String input = scanner.nextLine();
+
+ if ("list".equalsIgnoreCase(input)) {
+ List coffeeBeverages = service.findAllCoffeeBeverages();
+
+ for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
+ System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
+ coffeeBeverage.getName()));
+ }
+
+ } else {
+ System.out.println("Retrieving coffee information...");
+ String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));
+
+ System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
+ System.out.print("To try again, please enter another coffee beverage and press :\n\n");
+ }
+
+ }
+
+ LOGGER.info("Exiting application...bye.");
+
+ System.exit(0);
+
+ }
+}
diff --git a/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/model/CoffeeBeverage.java b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/model/CoffeeBeverage.java
new file mode 100644
index 00000000..b752537f
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/model/CoffeeBeverage.java
@@ -0,0 +1,131 @@
+/*
+ * 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.model;
+
+/**
+ *
+ * @author Gunnar Hillert
+ * @since 2.2
+ *
+ */
+public class CoffeeBeverage {
+
+ private Integer id;
+ private String name;
+ private String description;
+
+ /** Default Constructor */
+ public CoffeeBeverage() {
+ super();
+ }
+
+ /**
+ * @param id
+ * @param name
+ * @param description
+ */
+ public CoffeeBeverage(Integer id, String name, String description) {
+ super();
+ this.id = id;
+ this.name = name;
+ this.description = description;
+ }
+
+ public Integer getId() {
+ return this.id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime
+ * result
+ + ((this.description == null) ? 0 : this.description.hashCode());
+ result = prime * result
+ + ((this.name == null) ? 0 : this.name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ CoffeeBeverage other = (CoffeeBeverage) obj;
+
+ if (this.description == null) {
+
+ if (other.description != null) {
+ return false;
+ }
+
+ } else if (!this.description.equals(other.description)) {
+ return false;
+ }
+
+ if (this.name == null) {
+
+ if (other.name != null) {
+ return false;
+ }
+
+ } else if (!this.name.equals(other.name)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("CoffeeBeverage [id=").append(this.id).append(", name=")
+ .append(this.name).append(", description=")
+ .append(this.description).append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/service/CoffeeService.java b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/service/CoffeeService.java
new file mode 100644
index 00000000..da648bd8
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/service/CoffeeService.java
@@ -0,0 +1,50 @@
+/*
+ * 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.service;
+
+import java.util.List;
+
+import org.springframework.integration.annotation.Payload;
+import org.springframework.integration.model.CoffeeBeverage;
+import org.springframework.transaction.annotation.Transactional;
+
+
+/**
+ * Provides access to the Coffee Database Services.
+ *
+ * @author Gunnar Hillert
+ * @since 2.2
+ */
+@Transactional
+public interface CoffeeService {
+
+ /**
+ * Find the description for a provided coffee beverage.
+ *
+ * @param Id of the coffee beverage
+ * @return The the description of the coffee beverage
+ */
+ String findCoffeeBeverage(Integer input);
+
+ /**
+ * Find the description for a provided coffee beverage.
+ *
+ * @return Collection of coffee beverages
+ */
+ @Payload("new java.util.Date()")
+ List findAllCoffeeBeverages();
+
+}
diff --git a/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/support/CoffeBeverageMapper.java b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/support/CoffeBeverageMapper.java
new file mode 100644
index 00000000..3f246061
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/java/org/springframework/integration/support/CoffeBeverageMapper.java
@@ -0,0 +1,33 @@
+/*
+ * 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.support;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.springframework.integration.model.CoffeeBeverage;
+import org.springframework.jdbc.core.RowMapper;
+
+/**
+ *
+ * @author Gunnar Hillert
+ * @since 2.2
+ *
+ */
+public class CoffeBeverageMapper implements RowMapper {
+
+ public CoffeeBeverage mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return new CoffeeBeverage(rs.getInt("ID"), rs.getString("COFFEE_NAME"), rs.getString("COFFEE_DESCRIPTION"));
+ }
+
+}
diff --git a/intermediate/stored-procedures-postgresql/src/main/resources/META-INF/spring/integration/spring-integration-context.xml b/intermediate/stored-procedures-postgresql/src/main/resources/META-INF/spring/integration/spring-integration-context.xml
new file mode 100644
index 00000000..e934ff8f
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/resources/META-INF/spring/integration/spring-integration-context.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/intermediate/stored-procedures-postgresql/src/main/resources/log4j.xml b/intermediate/stored-procedures-postgresql/src/main/resources/log4j.xml
new file mode 100644
index 00000000..13705bbc
--- /dev/null
+++ b/intermediate/stored-procedures-postgresql/src/main/resources/log4j.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file