Cloud Foundry deployment
This commit is contained in:
@@ -5,7 +5,7 @@ path: ./target/account-web-0.0.1-SNAPSHOT.jar
|
|||||||
buildpack: java_buildpack
|
buildpack: java_buildpack
|
||||||
services:
|
services:
|
||||||
- rabbit-events
|
- rabbit-events
|
||||||
- redis-cache
|
- discovery-service
|
||||||
disk_quota: 1024M
|
disk_quota: 1024M
|
||||||
host: account-event-web
|
host: account-event-web
|
||||||
domain: cfapps.io
|
domain: cfapps.io
|
||||||
|
|||||||
@@ -31,10 +31,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
@@ -51,11 +47,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-integration</artifactId>
|
<artifactId>spring-boot-starter-integration</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.projectreactor</groupId>
|
|
||||||
<artifactId>reactor-core</artifactId>
|
|
||||||
<version>3.0.3.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
|
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
|
||||||
public class AccountServiceApplication {
|
public class AccountWeb {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AccountServiceApplication.class, args);
|
SpringApplication.run(AccountWeb.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,15 +5,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableWebMvc
|
||||||
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
@@ -37,4 +41,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
|||||||
converter.setObjectMapper(objectMapper);
|
converter.setObjectMapper(objectMapper);
|
||||||
return new RestTemplate(Collections.singletonList(converter));
|
return new RestTemplate(Collections.singletonList(converter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||||
|
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,6 @@ spring:
|
|||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
profiles: development
|
profiles: development
|
||||||
jackson:
|
|
||||||
default-property-inclusion: non_null
|
|
||||||
cloud:
|
cloud:
|
||||||
stream:
|
stream:
|
||||||
bindings:
|
bindings:
|
||||||
@@ -32,3 +30,26 @@ events:
|
|||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
output:
|
||||||
|
destination: account
|
||||||
|
contentType: 'application/json'
|
||||||
|
events:
|
||||||
|
worker: http://account-worker/v1/events
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ path: ./target/account-worker-0.0.1-SNAPSHOT.jar
|
|||||||
buildpack: java_buildpack
|
buildpack: java_buildpack
|
||||||
services:
|
services:
|
||||||
- rabbit-events
|
- rabbit-events
|
||||||
|
- discovery-service
|
||||||
disk_quota: 1024M
|
disk_quota: 1024M
|
||||||
host: account-event-worker
|
host: account-event-worker
|
||||||
domain: cfapps.io
|
domain: cfapps.io
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
||||||
public class OrderWorkerApplication {
|
public class AccountWorker {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(OrderWorkerApplication.class, args);
|
SpringApplication.run(AccountWorker.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("cloud")
|
@Profile("lambda")
|
||||||
public class AwsLambdaConfig {
|
public class AwsLambdaConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -27,3 +27,31 @@ spring:
|
|||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
input:
|
||||||
|
destination: account
|
||||||
|
group: account-group
|
||||||
|
contentType: 'application/json'
|
||||||
|
consumer:
|
||||||
|
durableSubscription: true
|
||||||
|
amazon:
|
||||||
|
aws:
|
||||||
|
access-key-id: ${AMAZON_AWS_ACCESS_KEY_ID:replace}
|
||||||
|
access-key-secret: ${AMAZON_AWS_ACCESS_KEY_SECRET:replace}
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
11
order/order-web/manifest.yml
Normal file
11
order/order-web/manifest.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: order-web
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
path: ./target/order-web-0.0.1-SNAPSHOT.jar
|
||||||
|
buildpack: java_buildpack
|
||||||
|
services:
|
||||||
|
- rabbit-events
|
||||||
|
- discovery-service
|
||||||
|
disk_quota: 1024M
|
||||||
|
host: order-event-web
|
||||||
|
domain: cfapps.io
|
||||||
@@ -31,10 +31,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
|
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
|
||||||
public class OrderWebApplication {
|
public class OrderWeb {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(OrderWebApplication.class, args);
|
SpringApplication.run(OrderWeb.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,15 +5,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableWebMvc
|
||||||
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
@@ -37,4 +41,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
|||||||
converter.setObjectMapper(objectMapper);
|
converter.setObjectMapper(objectMapper);
|
||||||
return new RestTemplate(Collections.singletonList(converter));
|
return new RestTemplate(Collections.singletonList(converter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||||
|
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -32,3 +32,26 @@ events:
|
|||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
output:
|
||||||
|
destination: order
|
||||||
|
contentType: 'application/json'
|
||||||
|
events:
|
||||||
|
worker: http://order-worker/v1/events
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
11
order/order-worker/manifest.yml
Normal file
11
order/order-worker/manifest.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: order-worker
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
path: ./target/order-worker-0.0.1-SNAPSHOT.jar
|
||||||
|
buildpack: java_buildpack
|
||||||
|
services:
|
||||||
|
- rabbit-events
|
||||||
|
- discovery-service
|
||||||
|
disk_quota: 1024M
|
||||||
|
host: order-event-worker
|
||||||
|
domain: cfapps.io
|
||||||
@@ -9,9 +9,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
||||||
public class PaymentStreamModuleApplication {
|
public class OrderWorker {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(PaymentStreamModuleApplication.class, args);
|
SpringApplication.run(OrderWorker.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("cloud")
|
@Profile("lambda")
|
||||||
public class AwsLambdaConfig {
|
public class AwsLambdaConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -29,3 +29,33 @@ eureka:
|
|||||||
enabled: false
|
enabled: false
|
||||||
server:
|
server:
|
||||||
port: 0
|
port: 0
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
input:
|
||||||
|
destination: order
|
||||||
|
group: order-group
|
||||||
|
contentType: 'application/json'
|
||||||
|
consumer:
|
||||||
|
durableSubscription: true
|
||||||
|
server:
|
||||||
|
port: 0
|
||||||
|
amazon:
|
||||||
|
aws:
|
||||||
|
access-key-id: replace
|
||||||
|
access-key-secret: replace
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
11
payment/payment-web/manifest.yml
Normal file
11
payment/payment-web/manifest.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: payment-web
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
path: ./target/payment-web-0.0.1-SNAPSHOT.jar
|
||||||
|
buildpack: java_buildpack
|
||||||
|
services:
|
||||||
|
- rabbit-events
|
||||||
|
- discovery-service
|
||||||
|
disk_quota: 1024M
|
||||||
|
host: payment-event-web
|
||||||
|
domain: cfapps.io
|
||||||
@@ -31,10 +31,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
|
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
|
||||||
public class PaymentServiceApplication {
|
public class PaymentWeb {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(PaymentServiceApplication.class, args);
|
SpringApplication.run(PaymentWeb.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,15 +5,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableWebMvc
|
||||||
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
@@ -37,4 +41,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
|||||||
converter.setObjectMapper(objectMapper);
|
converter.setObjectMapper(objectMapper);
|
||||||
return new RestTemplate(Collections.singletonList(converter));
|
return new RestTemplate(Collections.singletonList(converter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||||
|
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,11 +10,6 @@ spring:
|
|||||||
output:
|
output:
|
||||||
destination: payment
|
destination: payment
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
jackson:
|
|
||||||
default-property-inclusion: non_null
|
|
||||||
redis:
|
|
||||||
host: localhost
|
|
||||||
port: 6379
|
|
||||||
server:
|
server:
|
||||||
port: 0
|
port: 0
|
||||||
events:
|
events:
|
||||||
@@ -35,3 +30,26 @@ events:
|
|||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
output:
|
||||||
|
destination: payment
|
||||||
|
contentType: 'application/json'
|
||||||
|
events:
|
||||||
|
worker: http://payment-worker/v1/events
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
11
payment/payment-worker/manifest.yml
Normal file
11
payment/payment-worker/manifest.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: payment-worker
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
path: ./target/payment-worker-0.0.1-SNAPSHOT.jar
|
||||||
|
buildpack: java_buildpack
|
||||||
|
services:
|
||||||
|
- rabbit-events
|
||||||
|
- discovery-service
|
||||||
|
disk_quota: 1024M
|
||||||
|
host: payment-event-worker
|
||||||
|
domain: cfapps.io
|
||||||
@@ -9,9 +9,9 @@ import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
@EnableHypermediaSupport(type = {HypermediaType.HAL})
|
||||||
public class AccountStreamModuleApplication {
|
public class PaymentWorker {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AccountStreamModuleApplication.class, args);
|
SpringApplication.run(PaymentWorker.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("cloud")
|
@Profile("lambda")
|
||||||
public class AwsLambdaConfig {
|
public class AwsLambdaConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ spring:
|
|||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
consumer:
|
consumer:
|
||||||
durableSubscription: true
|
durableSubscription: true
|
||||||
jackson:
|
|
||||||
default-property-inclusion: non_null
|
|
||||||
server:
|
server:
|
||||||
port: 0
|
port: 0
|
||||||
amazon:
|
amazon:
|
||||||
@@ -27,3 +25,27 @@ spring:
|
|||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: cloud
|
||||||
|
cloud:
|
||||||
|
stream:
|
||||||
|
bindings:
|
||||||
|
input:
|
||||||
|
destination: payment
|
||||||
|
group: payment-group
|
||||||
|
contentType: 'application/json'
|
||||||
|
consumer:
|
||||||
|
durableSubscription: true
|
||||||
|
eureka:
|
||||||
|
instance:
|
||||||
|
hostname: ${vcap.application.uris[0]:localhost}
|
||||||
|
nonSecurePort: 80
|
||||||
|
metadataMap:
|
||||||
|
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
|
||||||
|
leaseRenewalIntervalInSeconds: 5
|
||||||
|
client:
|
||||||
|
region: default
|
||||||
|
registryFetchIntervalSeconds: 5
|
||||||
|
serviceUrl:
|
||||||
|
defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
|
||||||
8
platform-services/discovery/manifest.yml
Normal file
8
platform-services/discovery/manifest.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
name: discovery-service
|
||||||
|
memory: 512M
|
||||||
|
instances: 1
|
||||||
|
path: ./target/discovery-1.0-SNAPSHOT.jar
|
||||||
|
buildpack: java_buildpack
|
||||||
|
disk_quota: 1024M
|
||||||
|
host: event-stream-discovery-service
|
||||||
|
domain: cfapps.io
|
||||||
43
platform-services/discovery/pom.xml
Normal file
43
platform-services/discovery/pom.xml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?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>
|
||||||
|
<artifactId>discovery</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.kbastani</groupId>
|
||||||
|
<artifactId>platform-services</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-eureka-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.example;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
|
||||||
|
|
||||||
|
@EnableEurekaServer
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DiscoveryServiceApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DiscoveryServiceApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
server.port=8761
|
||||||
|
spring.application.name=discovery-service
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.example;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class DiscoveryServiceApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
platform-services/pom.xml
Normal file
29
platform-services/pom.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
<artifactId>platform-services</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>platform-services</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.kbastani</groupId>
|
||||||
|
<artifactId>event-stream-processing-microservices</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>discovery</module>
|
||||||
|
</modules>
|
||||||
|
</project>
|
||||||
Reference in New Issue
Block a user