Move AMQP sample to rabbitmq package

Issue #3663
This commit is contained in:
Mahmoud Ben Hassine
2023-09-25 08:53:56 +02:00
parent e693879144
commit 1eab6f63ed
4 changed files with 29 additions and 16 deletions

View File

@@ -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

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.sample.amqp;
package org.springframework.batch.sample.rabbitmq;
import javax.sql.DataSource;
@@ -29,6 +29,7 @@ import org.springframework.batch.item.ItemReader;
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;
@@ -55,6 +56,7 @@ public class AmqpJobConfiguration {
RabbitTemplate rabbitInputTemplate, RabbitTemplate rabbitOutputTemplate) {
return new StepBuilder("step", jobRepository).<String, String>chunk(1, transactionManager)
.reader(amqpItemReader(rabbitInputTemplate))
.processor(new MessageProcessor())
.writer(amqpItemWriter(rabbitOutputTemplate))
.build();
}

View File

@@ -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

View File

@@ -36,7 +36,7 @@ import org.springframework.batch.core.explore.JobExplorer;
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;