Skip to content

Commit 1eab6f6

Browse files
committed
Move AMQP sample to rabbitmq package
Issue #3663
1 parent e693879 commit 1eab6f6

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

spring-batch-samples/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,7 @@ The `AmqpItemReader` and Writer were contributed by Chris Schaefer.
124124
It is modeled after the `JmsItemReader` / Writer implementations, which
125125
are popular models for remote chunking. It leverages the `AmqpTemplate`.
126126

127-
This example requires the env to have a copy of rabbitmq installed
128-
and running. The standard dashboard can be used to see the traffic
129-
from the `MessageProducer` to the `AmqpItemWriter`. Make sure you
130-
launch the `MessageProducer` before launching the test.
131-
132-
You can run the sample from the command line as following:
133-
134-
```
135-
cd spring-batch-samples
136-
# Launch the test using the XML configuration
137-
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithXmlConfig test
138-
# Launch the test using the Java configuration
139-
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithJavaConfig test
140-
```
127+
[Amqp Job Sample](./src/main/java/org/springframework/batch/sample/rabbitmq/README.md)
141128

142129
### BeanWrapperMapper Sample
143130

spring-batch-samples/src/main/java/org/springframework/batch/sample/amqp/AmqpJobConfiguration.java renamed to spring-batch-samples/src/main/java/org/springframework/batch/sample/rabbitmq/AmqpJobConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.batch.sample.amqp;
17+
package org.springframework.batch.sample.rabbitmq;
1818

1919
import javax.sql.DataSource;
2020

@@ -29,6 +29,7 @@
2929
import org.springframework.batch.item.ItemWriter;
3030
import org.springframework.batch.item.amqp.builder.AmqpItemReaderBuilder;
3131
import org.springframework.batch.item.amqp.builder.AmqpItemWriterBuilder;
32+
import org.springframework.batch.sample.rabbitmq.processor.MessageProcessor;
3233
import org.springframework.context.annotation.Bean;
3334
import org.springframework.context.annotation.Configuration;
3435
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
@@ -55,6 +56,7 @@ public Step step(JobRepository jobRepository, JdbcTransactionManager transaction
5556
RabbitTemplate rabbitInputTemplate, RabbitTemplate rabbitOutputTemplate) {
5657
return new StepBuilder("step", jobRepository).<String, String>chunk(1, transactionManager)
5758
.reader(amqpItemReader(rabbitInputTemplate))
59+
.processor(new MessageProcessor())
5860
.writer(amqpItemWriter(rabbitOutputTemplate))
5961
.build();
6062
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# AMQP sample Job
2+
3+
## About
4+
5+
This sample shows the use of Spring Batch to write to an `AmqpItemWriter`.
6+
The `AmqpItemReader` and Writer were contributed by Chris Schaefer.
7+
It is modeled after the `JmsItemReader` / Writer implementations, which
8+
are popular models for remote chunking. It leverages the `AmqpTemplate`.
9+
10+
## Run the sample
11+
12+
This example requires the env to have a copy of rabbitmq installed
13+
and running. The standard dashboard can be used to see the traffic
14+
from the `MessageProducer` to the `AmqpItemWriter`. Make sure you
15+
launch the `MessageProducer` before launching the test.
16+
17+
You can run the sample from the command line as following:
18+
19+
```
20+
cd spring-batch-samples
21+
# Launch the test using the XML configuration
22+
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithXmlConfig test
23+
# Launch the test using the Java configuration
24+
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithJavaConfig test

spring-batch-samples/src/test/java/org/springframework/batch/sample/AMQPJobFunctionalTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.springframework.batch.core.launch.JobLauncher;
3737
import org.springframework.batch.item.ItemReader;
3838
import org.springframework.batch.item.ItemWriter;
39-
import org.springframework.batch.sample.amqp.AmqpJobConfiguration;
39+
import org.springframework.batch.sample.rabbitmq.AmqpJobConfiguration;
4040
import org.springframework.batch.test.JobLauncherTestUtils;
4141
import org.springframework.beans.factory.annotation.Autowired;
4242
import org.springframework.context.annotation.Bean;

0 commit comments

Comments
 (0)