Add support for Spring Rabbit (via Spring AMQP) to Boot

- If RabbitTemplate is on the classpath, turn on autodetection.
- Create a RabbitTemplate, a Rabbit ConnectionFactory, and a RabbitAdmin is spring.rabbitmq.dynamic:true
- Enable some **spring.rabbitmq** properties like host, port, username, password, and dynamic
- Add tests to verify functionality
- Add Groovy CLI functionality. Base it on @EnableRabbitMessaging. Add spring-amqp to the path.
- Create rabbit.groovy test to prove it all works.
- Make Queue and TopicExchange top-level Spring beans in rabbit.groovy test script
This commit is contained in:
Greg Turnquist
2013-09-25 10:31:03 -05:00
committed by Dave Syer
parent fa6e6fde6c
commit 941d163709
10 changed files with 401 additions and 5 deletions

View File

@@ -24,11 +24,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.ivy.util.FileUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.*;
import org.springframework.boot.OutputCapture;
import org.springframework.boot.cli.command.CleanCommand;
import org.springframework.boot.cli.command.RunCommand;
@@ -196,4 +192,13 @@ public class SampleIntegrationTests {
FileUtil.forceDelete(new File("activemq-data")); // cleanup ActiveMQ cruft
}
@Test
@Ignore // this test requires RabbitMQ to be run, so disable it be default
public void rabbitSample() throws Exception {
start("samples/rabbit.groovy");
String output = this.outputCapture.getOutputAndRelease();
assertTrue("Wrong output: " + output,
output.contains("Received Greetings from Spring Boot via RabbitMQ"));
}
}