diff --git a/spring-batch-integration/.classpath b/spring-batch-integration/.classpath
new file mode 100644
index 000000000..35c37d99e
--- /dev/null
+++ b/spring-batch-integration/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-integration/.project b/spring-batch-integration/.project
new file mode 100644
index 000000000..135d74a02
--- /dev/null
+++ b/spring-batch-integration/.project
@@ -0,0 +1,29 @@
+
+
+ spring-integration-batch
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.devzuz.q.maven.jdt.core.mavenNature
+
+
diff --git a/spring-batch-integration/.settings/org.eclipse.jdt.core.prefs b/spring-batch-integration/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f0eda8040
--- /dev/null
+++ b/spring-batch-integration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Mon Jun 02 08:35:20 BST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/spring-batch-integration/.settings/org.springframework.ide.eclipse.core.prefs b/spring-batch-integration/.settings/org.springframework.ide.eclipse.core.prefs
new file mode 100644
index 000000000..99192453d
--- /dev/null
+++ b/spring-batch-integration/.settings/org.springframework.ide.eclipse.core.prefs
@@ -0,0 +1,49 @@
+#Mon Jun 02 08:59:31 BST 2008
+eclipse.preferences.version=1
+org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true
+org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false
+org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=true
+org.springframework.ide.eclipse.core.enable.project.preferences=false
+org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=true
+org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.RefElementRule-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.legacyxmlusage.jndiobjectfactory-com.springsource.sts.bestpractices.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=true
+org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
diff --git a/spring-batch-integration/.springBeans b/spring-batch-integration/.springBeans
new file mode 100644
index 000000000..13e46bd54
--- /dev/null
+++ b/spring-batch-integration/.springBeans
@@ -0,0 +1,20 @@
+
+
+ 1
+
+
+
+
+
+
+ src/test/resources/integration-context.xml
+ src/test/resources/job-execution-context.xml
+ src/test/resources/org/springframework/integration/batch/launch/JobLaunchingMessageHandlerIntegrationTests-context.xml
+ src/test/resources/org/springframework/integration/batch/item/MessageChannelItemWriterIntegrationTests-context.xml
+ src/test/resources/org/springframework/integration/batch/job/MessageOrientedStepIntegrationTests-context.xml
+ src/test/resources/org/springframework/integration/batch/file/ResourceSplitterIntegrationTests-context.xml
+ src/test/resources/simple-job-launcher-context.xml
+
+
+
+
diff --git a/spring-batch-integration/pom.xml b/spring-batch-integration/pom.xml
new file mode 100644
index 000000000..f19873fbf
--- /dev/null
+++ b/spring-batch-integration/pom.xml
@@ -0,0 +1,126 @@
+
+
+
+ 4.0.0
+ org.springframework.batch
+ spring-batch-integration
+ jar
+ 1.1.0.DEV-SNAPSHOT
+
+ true
+ 2.5.4.A
+ 1.0.0.M4
+
+
+
+ javax.jms
+ jms
+ 1.1
+ compile
+
+
+ junit
+ junit
+ 4.4
+ test
+
+
+ log4j
+ log4j
+ 1.2.12
+ test
+
+
+ cglib
+ cglib-nodep
+ 2.1_3
+ test
+
+
+ org.springframework.integration
+ org.springframework.integration
+ ${spring.integration.version}
+ compile
+
+
+ org.springframework.integration
+ org.springframework.integration.adapter
+ ${spring.integration.version}
+ compile
+
+
+ org.springframework
+ org.springframework.context
+ ${spring.framework.version}
+ compile
+
+
+ org.springframework
+ org.springframework.aop
+ ${spring.framework.version}
+ compile
+
+
+ org.springframework
+ org.springframework.jms
+ ${spring.framework.version}
+ compile
+
+
+ org.springframework
+ org.springframework.transaction
+ ${spring.framework.version}
+ compile
+
+
+ org.springframework
+ org.springframework.test
+ ${spring.framework.version}
+ test
+
+
+ org.springframework.batch
+ spring-batch-core
+ 1.1.0.DEV-SNAPSHOT
+ compile
+
+
+ org.springframework
+ spring-context
+
+
+ org.springframework
+ spring-beans
+
+
+ org.springframework
+ spring-aop
+
+
+
+
+
+
+ springsource-external
+ http://repository.springsource.com/maven/bundles/external
+
+
+ springsource-release
+ http://repository.springsource.com/maven/bundles/release
+
+
+ springsource-milestone
+ http://repository.springsource.com/maven/bundles/milestone
+
+
+
+ springsource-snapshot
+ http://repository.springsource.com/maven/bundles/snapshot
+
+
+
diff --git a/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/AsynchronousFailureException.java b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/AsynchronousFailureException.java
new file mode 100644
index 000000000..69a00f084
--- /dev/null
+++ b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/AsynchronousFailureException.java
@@ -0,0 +1,37 @@
+package org.springframework.integration.batch.chunk;
+
+import org.springframework.batch.item.ItemWriterException;
+
+/**
+ * Exception indicating that a failure or early completion condition was
+ * detected in a remote worker.
+ *
+ * @author Dave Syer
+ *
+ */
+public class AsynchronousFailureException extends ItemWriterException {
+
+ /**
+ * Create a new {@link AsynchronousFailureException} based on a message and
+ * another exception.
+ *
+ * @param message
+ * the message for this exception
+ * @param cause
+ * the other exception
+ */
+ public AsynchronousFailureException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create a new {@link AsynchronousFailureException} based on a message.
+ *
+ * @param message
+ * the message for this exception
+ */
+ public AsynchronousFailureException(String message) {
+ super(message);
+ }
+
+}
diff --git a/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkHandler.java b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkHandler.java
new file mode 100644
index 000000000..3f496d10c
--- /dev/null
+++ b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkHandler.java
@@ -0,0 +1,8 @@
+package org.springframework.integration.batch.chunk;
+
+
+public interface ChunkHandler {
+
+ ChunkResponse handleChunk(ChunkRequest chunk);
+
+}
\ No newline at end of file
diff --git a/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkMessageChannelItemWriter.java b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkMessageChannelItemWriter.java
new file mode 100644
index 000000000..2d7f7b61c
--- /dev/null
+++ b/spring-batch-integration/src/main/java/org/springframework/integration/batch/chunk/ChunkMessageChannelItemWriter.java
@@ -0,0 +1,255 @@
+package org.springframework.integration.batch.chunk;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.batch.core.BatchStatus;
+import org.springframework.batch.core.StepExecution;
+import org.springframework.batch.core.listener.StepExecutionListenerSupport;
+import org.springframework.batch.item.ClearFailedException;
+import org.springframework.batch.item.ExecutionContext;
+import org.springframework.batch.item.FlushFailedException;
+import org.springframework.batch.item.ItemStream;
+import org.springframework.batch.item.ItemStreamException;
+import org.springframework.batch.item.ItemWriter;
+import org.springframework.batch.item.database.HibernateAwareItemWriter;
+import org.springframework.batch.repeat.ExitStatus;
+import org.springframework.batch.repeat.RepeatContext;
+import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.message.GenericMessage;
+import org.springframework.integration.message.Message;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.util.Assert;
+
+public class ChunkMessageChannelItemWriter extends StepExecutionListenerSupport implements ItemWriter, ItemStream {
+
+ private static final Log logger = LogFactory.getLog(ChunkMessageChannelItemWriter.class);
+
+ /**
+ * Key for items processed in the current transaction {@link RepeatContext}.
+ */
+ private static final String ITEMS_PROCESSED = HibernateAwareItemWriter.class.getName() + ".ITEMS_PROCESSED";
+
+ static final String ACTUAL = "ACTUAL";
+
+ static final String EXPECTED = "EXPECTED";
+
+ private static final long DEFAULT_THROTTLE_LIMIT = 6;
+
+ private MessageChannel requestChannel;
+
+ private MessageChannel replyChannel;
+
+ // TODO: abstract the state or make a factory for this writer?
+ private LocalState localState = new LocalState();
+
+ private long throttleLimit = DEFAULT_THROTTLE_LIMIT;
+
+ public void setReplyChannel(MessageChannel replyChannel) {
+ this.replyChannel = replyChannel;
+ }
+
+ public void setRequestChannel(MessageChannel requestChannel) {
+ this.requestChannel = requestChannel;
+ }
+
+ public void write(Object item) throws Exception {
+ bindTransactionResources();
+ getProcessed().add(item);
+ logger.debug("Added item to chunk: " + item);
+ }
+
+ /**
+ * Flush the buffer.
+ *
+ * @see org.springframework.batch.item.ItemWriter#flush()
+ */
+ public void flush() throws FlushFailedException {
+
+ bindTransactionResources(); // in case we are called outside a
+ // transaction
+
+ // Block until expecting < throttle limit - can Spring
+ // Integration do that for me?
+ while (localState.getExpecting() > throttleLimit) {
+ getNextResult(100);
+ }
+
+ List