Add bus sample for redis and rabbit

This commit is contained in:
Dave Syer
2016-02-15 17:04:55 +00:00
parent 0fcded79b3
commit 4ee1df5c80
9 changed files with 152 additions and 5 deletions

View File

@@ -0,0 +1,4 @@
redis:
image: redis
ports:
- "6379:6379"

92
bus-redis/pom.xml Normal file
View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud</groupId>
<artifactId>bus-redis</artifactId>
<version>Brixton.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>bus-redis</name>
<description>Demo project for Spring Cloud</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.BUILD-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<!--skip deploy (this is just a test module) -->
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@@ -0,0 +1,15 @@
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Dave Syer
*/
@SpringBootApplication
public class StandaloneClientApplication {
public static void main(String[] args) {
SpringApplication.run(StandaloneClientApplication.class, args);
}
}

View File

@@ -0,0 +1,9 @@
spring:
application:
name: bus
---
spring:
profiles: other
server:
port: 8081

View File

@@ -0,0 +1,25 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.config.client.ConfigServicePropertySourceLocator;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = StandaloneClientApplication.class)
@IntegrationTest
@DirtiesContext
public class StandaloneClientApplicationTests {
@Autowired
private ConfigServicePropertySourceLocator locator;
@Test
public void contextLoads() throws Exception {
}
}

View File

@@ -1,4 +1,5 @@
redis:
image: redis
rabbitmq:
image: rabbitmq:management
ports:
- "6379:6379"
- "5672:5672"
- "15672:15672"

View File

@@ -42,7 +42,7 @@
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-redis</artifactId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -12,4 +12,4 @@ public class StandaloneClientApplication {
public static void main(String[] args) {
SpringApplication.run(StandaloneClientApplication.class, args);
}
}
}

View File

@@ -19,6 +19,7 @@
</organization>
<modules>
<module>bus</module>
<module>bus-redis</module>
<module>config-client</module>
<module>config-client-decrypt</module>
<module>config-retry</module>