Skip to content

Commit

Permalink
Move AMQP sample to rabbitmq package
Browse files Browse the repository at this point in the history
Issue #3663
  • Loading branch information
fmbenhassine committed Sep 25, 2023
1 parent e693879 commit 1eab6f6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
15 changes: 1 addition & 14 deletions spring-batch-samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,7 @@ The `AmqpItemReader` and Writer were contributed by Chris Schaefer.
It is modeled after the `JmsItemReader` / Writer implementations, which
are popular models for remote chunking. It leverages the `AmqpTemplate`.

This example requires the env to have a copy of rabbitmq installed
and running. The standard dashboard can be used to see the traffic
from the `MessageProducer` to the `AmqpItemWriter`. Make sure you
launch the `MessageProducer` before launching the test.

You can run the sample from the command line as following:

```
cd spring-batch-samples
# Launch the test using the XML configuration
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithXmlConfig test
# Launch the test using the Java configuration
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithJavaConfig test
```
[Amqp Job Sample](./src/main/java/org/springframework/batch/sample/rabbitmq/README.md)

### BeanWrapperMapper Sample

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.batch.sample.amqp;
package org.springframework.batch.sample.rabbitmq;

import javax.sql.DataSource;

Expand All @@ -29,6 +29,7 @@
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.amqp.builder.AmqpItemReaderBuilder;
import org.springframework.batch.item.amqp.builder.AmqpItemWriterBuilder;
import org.springframework.batch.sample.rabbitmq.processor.MessageProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
Expand All @@ -55,6 +56,7 @@ public Step step(JobRepository jobRepository, JdbcTransactionManager transaction
RabbitTemplate rabbitInputTemplate, RabbitTemplate rabbitOutputTemplate) {
return new StepBuilder("step", jobRepository).<String, String>chunk(1, transactionManager)
.reader(amqpItemReader(rabbitInputTemplate))
.processor(new MessageProcessor())
.writer(amqpItemWriter(rabbitOutputTemplate))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# AMQP sample Job

## About

This sample shows the use of Spring Batch to write to an `AmqpItemWriter`.
The `AmqpItemReader` and Writer were contributed by Chris Schaefer.
It is modeled after the `JmsItemReader` / Writer implementations, which
are popular models for remote chunking. It leverages the `AmqpTemplate`.

## Run the sample

This example requires the env to have a copy of rabbitmq installed
and running. The standard dashboard can be used to see the traffic
from the `MessageProducer` to the `AmqpItemWriter`. Make sure you
launch the `MessageProducer` before launching the test.

You can run the sample from the command line as following:

```
cd spring-batch-samples
# Launch the test using the XML configuration
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithXmlConfig test
# Launch the test using the Java configuration
../mvnw -Dtest=AMQPJobFunctionalTests#testLaunchJobWithJavaConfig test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.sample.amqp.AmqpJobConfiguration;
import org.springframework.batch.sample.rabbitmq.AmqpJobConfiguration;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
Expand Down

0 comments on commit 1eab6f6

Please sign in to comment.