diff --git a/.travis.yml b/.travis.yml
index 3a412a0a..e0891e44 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+dist: trusty
language: java
jdk: oraclejdk8
sudo: false
diff --git a/build.gradle b/build.gradle
index fc2613c2..85e82e3c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -210,6 +210,7 @@ subprojects { subproject ->
postgresVersion = '42.2.9'
subethasmtpVersion = '1.2'
slf4jVersion = '1.7.25'
+ springCloudVersion ='Hoxton.SR3'
springIntegrationVersion = '5.3.0.M3'
springIntegrationKafkaVersion = '3.2.1.RELEASE'
springIntegrationSocialTwiterVersion = '1.0.1.BUILD-SNAPSHOT'
@@ -218,6 +219,7 @@ subprojects { subproject ->
springVersion = '5.2.4.RELEASE'
springSecurityVersion = '5.3.0.RC1'
springWebFlowVersion = '2.3.3.RELEASE'
+ testcontainersVersion = '1.13.0'
tilesJspVersion = '2.2.1'
validationApiVersion = '1.0.0.GA'
}
@@ -917,6 +919,44 @@ project('tcp-client-server') {
}
}
+project('testcontainers-rabbitmq') {
+ description = 'Testcontainers RabbitMQ Sample'
+
+ apply plugin: 'org.springframework.boot'
+
+ bootRun {
+ main = 'org.springframework.integration.samples.testcontainersrabbitmq.TestcontainersRabbitmqApplication'
+ }
+
+ dependencies {
+ compile "org.springframework.boot:spring-boot-starter-integration"
+ compile "org.springframework.integration:spring-integration-amqp"
+ compile "org.springframework.boot:spring-boot-starter-json"
+
+ testCompile('org.springframework.boot:spring-boot-starter-test') {
+ exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
+ }
+ testCompile 'org.springframework.integration:spring-integration-test'
+ testCompile 'org.springframework.amqp:spring-rabbit-test'
+ testCompile 'org.springframework.cloud:spring-cloud-starter'
+
+ testCompile "org.testcontainers:junit-jupiter:$testcontainersVersion"
+ testCompile "com.playtika.testcontainers:embedded-rabbitmq:1.42"
+
+ }
+
+ dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"
+ }
+ }
+
+ test {
+ useJUnitPlatform()
+ }
+
+}
+
project('testing-examples') {
description = 'Testing Examples'
diff --git a/intermediate/testcontainers-rabbitmq/README.md b/intermediate/testcontainers-rabbitmq/README.md
new file mode 100644
index 00000000..aa131dac
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/README.md
@@ -0,0 +1,53 @@
+Testcontainers - RabbitMQ Sample
+==================================
+
+Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
+
+[Testcontainers](https://www.testcontainers.org/)
+
+This sample demonstrates how to setup and configure the embedded RabbitMQ Docker container for use in testing Spring Integration projects that require RabbitMQ.
+
+A simple `IntegrationFlow` is setup to establish a message is published to an `OutboundGateway` and handled by some _downstream_ process.
+It expects a response to come back on some reply-to channel established by the `RabbitTemplate`.
+
+In the real world scenario, the Topic Exchange and Queues would have already been established by the _downstream_ application.
+To aid in testing, when the RabbitMQ Testcontainer comes up, the correct Topic Exchange and Queues are created and provide simple message and handling and responses.
+
+**Note**: These tests take a bit longer run to allow time for the Docker image to spin up and tear down.
+
+## Embedded RabbitMQ
+
+The project dependency adds Spring Boot Autoconfiguration for test containers that automatically sets up and configures the embedded docker image
+
+```groovy
+testCompile "com.playtika.testcontainers:embedded-rabbitmq:1.42"
+```
+
+Configuration is performed in `src/test/resources/application.yml` to point the Spring Boot RabbitMQ Autoconfiguration to the properties exposed by the library
+
+```yml
+spring:
+ rabbitmq:
+ host: ${embedded.rabbitmq.host}
+ port: ${embedded.rabbitmq.port}
+ username: ${embedded.rabbitmq.user}
+ password: ${embedded.rabbitmq.password}
+ virtual-host: ${embedded.rabbitmq.vhost}
+```
+
+[testcontainers-spring-boot](https://github.com/testcontainers/testcontainers-spring-boot)
+
+## Architecture
+
+The `IntegrationFlow` is setup to publish a message to a RabbitMQ `TopicExchange`. A `RoutingKey` is used to direct this message to an appropriate `Queue`.
+The result is sent back to the _flow_ on a separate reply-to `Queue`.
+
+It is deliberately setup this way to model a real-world scenario we ran into. The calling application is a Spring Boot application and the downstream application is a Python ML application.
+
+## Execute the tests
+
+The Gradle Wrapper is provided to execute the tests.
+
+```bash
+$ ./gradlew :testcontainers-rabbitmq:test
+```
\ No newline at end of file
diff --git a/intermediate/testcontainers-rabbitmq/pom.xml b/intermediate/testcontainers-rabbitmq/pom.xml
new file mode 100644
index 00000000..1a74c00b
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/pom.xml
@@ -0,0 +1,283 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.0.BUILD-SNAPSHOT
+
+ org.springframework.integration.samples
+ testcontainers-rabbitmq
+ 5.3.0.BUILD-SNAPSHOT
+ Testcontainers RabbitMQ Sample
+ Testcontainers RabbitMQ Sample
+ https://projects.spring.io/spring-integration
+
+ SpringIO
+ https://spring.io
+
+
+
+ The Apache Software License, Version 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ abilan
+ Artem Bilan
+ abilan@pivotal.io
+
+ project lead
+
+
+
+ garyrussell
+ Gary Russell
+ grussell@pivotal.io
+
+ lead emeritus
+
+
+
+ markfisher
+ Mark Fisher
+ mfisher@pivotal.io
+
+ project founder and lead emeritus
+
+
+
+ ghillert
+ Gunnar Hillert
+ ghillert@pivotal.io
+
+
+
+ scm:git:scm:git:git://github.com/spring-projects/spring-integration-samples.git
+ scm:git:scm:git:ssh://git@github.com:spring-projects/spring-integration-samples.git
+ https://github.com/spring-projects/spring-integration-samples
+
+
+
+ org.springframework.boot
+ spring-boot-starter-integration
+ compile
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.springframework.integration
+ spring-integration-amqp
+ compile
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-json
+ compile
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+ *
+ org.hamcrest
+
+
+
+
+ org.hamcrest
+ hamcrest-all
+ 1.3
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.mockito
+ mockito-core
+ 3.2.4
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+ *
+ org.hamcrest
+
+
+
+
+ org.springframework
+ spring-test
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+ junit-vintage-engine
+ org.junit.vintage
+
+
+
+
+ org.springframework.integration
+ spring-integration-test
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.springframework.amqp
+ spring-rabbit-test
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ org.testcontainers
+ junit-jupiter
+ 1.13.0
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+ com.playtika.testcontainers
+ embedded-rabbitmq
+ 1.42
+ test
+
+
+ jackson-module-kotlin
+ com.fasterxml.jackson.module
+
+
+
+
+
+
+ repo.spring.io.milestone
+ Spring Framework Maven Milestone Repository
+ https://repo.spring.io/libs-milestone
+
+
+ repo.spring.io.snapshot
+ Spring Framework Maven Snapshot Repository
+ https://repo.spring.io/libs-snapshot
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ Hoxton.SR3
+ import
+ pom
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ 2.3.0.BUILD-SNAPSHOT
+ import
+ pom
+
+
+ com.fasterxml.jackson
+ jackson-bom
+ 2.10.2.20200130
+ import
+ pom
+
+
+ org.springframework
+ spring-framework-bom
+ 5.2.4.RELEASE
+ import
+ pom
+
+
+ org.springframework.integration
+ spring-integration-bom
+ 5.3.0.M3
+ import
+ pom
+
+
+
+
diff --git a/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfig.java b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfig.java
new file mode 100644
index 00000000..6b470d38
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfig.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
+import org.springframework.amqp.support.converter.MessageConverter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.amqp.dsl.Amqp;
+import org.springframework.integration.dsl.IntegrationFlow;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Configuration
+public class IntegrationConfig {
+
+ @Bean
+ public IntegrationFlow request(RabbitTemplate amqpTemplate) {
+ return f -> f
+ .log()
+ .handle(Amqp.outboundGateway(amqpTemplate)
+ .exchangeName("downstream")
+ .routingKey("downstream.request"));
+ }
+
+ @Bean
+ public MessageConverter jsonMessageConverter(ObjectMapper objectMapper) {
+ return new Jackson2JsonMessageConverter(objectMapper);
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Request.java b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Request.java
new file mode 100644
index 00000000..415015ee
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Request.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import java.util.UUID;
+
+public class Request {
+
+ private final UUID id;
+
+ private final Integer messageId;
+
+ public Request(UUID id, Integer messageId) {
+ this.id = id;
+ this.messageId = messageId;
+ }
+
+ public UUID getId() {
+ return this.id;
+ }
+
+ public Integer getMessageId() {
+ return this.messageId;
+ }
+
+ @Override
+ public String toString() {
+ return "Request{" +
+ "id=" + this.id +
+ ", messageId=" + this.messageId +
+ '}';
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Response.java b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Response.java
new file mode 100644
index 00000000..c2f39bf0
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/Response.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import java.util.UUID;
+
+public class Response {
+
+ private final UUID requestId;
+
+ private final String message;
+
+ public Response(UUID requestId, String message) {
+ this.requestId = requestId;
+ this.message = message;
+ }
+
+ public UUID getRequestId() {
+ return this.requestId;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ @Override
+ public String toString() {
+ return "Response{" +
+ "requestId=" + this.requestId +
+ ", message='" + this.message + '\'' +
+ '}';
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/TestcontainersRabbitmqApplication.java b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/TestcontainersRabbitmqApplication.java
new file mode 100644
index 00000000..a77eb35c
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/main/java/org/springframework/integration/samples/testcontainersrabbitmq/TestcontainersRabbitmqApplication.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class TestcontainersRabbitmqApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(TestcontainersRabbitmqApplication.class, args);
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/main/resources/application.yml b/intermediate/testcontainers-rabbitmq/src/main/resources/application.yml
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/main/resources/application.yml
@@ -0,0 +1 @@
+
diff --git a/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfigTests.java b/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfigTests.java
new file mode 100644
index 00000000..260dc3ac
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/IntegrationConfigTests.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import org.junit.jupiter.api.Test;
+
+import org.springframework.amqp.core.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Import;
+import org.springframework.integration.core.MessagingTemplate;
+import org.springframework.integration.test.context.SpringIntegrationTest;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.support.MessageBuilder;
+
+import java.util.UUID;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@SpringBootTest
+@SpringIntegrationTest
+@Import({ Receiver.class, IntegrationConfigTests.Config.class })
+class IntegrationConfigTests {
+
+ @Autowired
+ @Qualifier("request.input")
+ private MessageChannel requestInput;
+
+ @Test
+ public void test() {
+ MessagingTemplate messagingTemplate = new MessagingTemplate();
+ UUID requestId = UUID.randomUUID();
+ Request fakeRequest = new Request(requestId, 1);
+
+ Message> receive =
+ messagingTemplate
+ .sendAndReceive(requestInput,
+ MessageBuilder
+ .withPayload(fakeRequest)
+ .setHeader("Content-Type", "application/json")
+ .build()
+ );
+ assertThat(receive).isNotNull();
+ assertThat(receive.getPayload()).isInstanceOf(Response.class);
+
+ Response actual = (Response) receive.getPayload();
+ assertThat(actual.getRequestId()).isEqualTo(requestId);
+ assertThat(actual.getMessage()).isEqualTo("This is message 1");
+
+ }
+
+ @TestConfiguration
+ public static class Config {
+
+ public static final String TOPIC_EXCHANGE = "downstream";
+
+ public static final String RESULTS_QUEUE = "downstream.results";
+
+ public static final String RESULTS_ROUTING_KEY = "downstream.results.#";
+
+ @Bean
+ TopicExchange topicExchange() {
+
+ return ExchangeBuilder
+ .topicExchange(TOPIC_EXCHANGE)
+ .build();
+ }
+
+ @Bean
+ Queue resultsQueue() {
+
+ return QueueBuilder
+ .nonDurable(RESULTS_QUEUE)
+ .build();
+ }
+
+ @Bean
+ Binding resultsBinding(TopicExchange topicExchange, Queue resultsQueue) {
+
+ return BindingBuilder.bind(resultsQueue)
+ .to(topicExchange)
+ .with(RESULTS_ROUTING_KEY);
+ }
+
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/Receiver.java b/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/Receiver.java
new file mode 100644
index 00000000..f54d94c1
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/test/java/org/springframework/integration/samples/testcontainersrabbitmq/Receiver.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2002-2020 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
+ *
+ * https://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.samples.testcontainersrabbitmq;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import javax.annotation.PostConstruct;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.amqp.rabbit.annotation.Exchange;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.QueueBinding;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.messaging.handler.annotation.SendTo;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Receiver {
+
+ private static final Logger log = LoggerFactory.getLogger(Receiver.class);
+
+ private static final Map messages;
+
+ static {
+
+ messages = new HashMap<>();
+
+ messages.put(1, "This is message 1");
+ messages.put(2, "This is message 2");
+ messages.put(3, "This is message 3");
+ messages.put(4, "This is message 4");
+ messages.put(5, "This is message 5");
+
+ }
+
+ @PostConstruct
+ public void initialize() {
+ log.info("Receiver initialized!");
+ }
+
+ @RabbitListener(
+ bindings = @QueueBinding(
+ value = @Queue(value = "downstream.request", durable = "true"),
+ exchange = @Exchange(value = "downstream", ignoreDeclarationExceptions = "true", type = "topic"),
+ key = "downstream.request.#"
+ )
+ )
+ @SendTo("downstream.results")
+ public Response handleMessage(Request request) {
+ log.info("handleMessage : received message [{}]", request);
+
+ Integer messageId;
+ if (null != request.getMessageId()) {
+
+ messageId = request.getMessageId();
+
+ }
+ else {
+
+ messageId = new Random().ints(1, 5).findFirst().getAsInt();
+
+ }
+
+ return new Response(request.getId(), messages.get(messageId));
+ }
+
+}
diff --git a/intermediate/testcontainers-rabbitmq/src/test/resources/application.yml b/intermediate/testcontainers-rabbitmq/src/test/resources/application.yml
new file mode 100644
index 00000000..140c9767
--- /dev/null
+++ b/intermediate/testcontainers-rabbitmq/src/test/resources/application.yml
@@ -0,0 +1,11 @@
+logging.level:
+ org.springframework.integration: DEBUG
+ com.playtika.test: DEBUG
+
+spring:
+ rabbitmq:
+ host: ${embedded.rabbitmq.host}
+ port: ${embedded.rabbitmq.port}
+ username: ${embedded.rabbitmq.user}
+ password: ${embedded.rabbitmq.password}
+ virtual-host: ${embedded.rabbitmq.vhost}