SlideShare a Scribd company logo
1 of 67
Download to read offline
‹#›© 2016 Pivotal Software, Inc. All rights reserved. ‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Services
Toshiaki Maki (@making)
PCF Meetup
2016-06-29
© 2016 Pivotal Software, Inc. All rights reserved.
Who am I ?
• Toshiaki Maki (@making)
• Sr. Solutions Architect
• Spring Framework enthusiast
Perfect
Java EE
(Coming Soon)
bit.ly/spring-book
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud
• Omakase Microservices
© 2016 Pivotal Software, Inc. All rights reserved.
• Service Discovery
• API Gateway
• Client-side Load Balancing
• Circuit Breakers
• Distributed Configuration
• Distributed Tracing
Spring Cloud Provides
Hystrix
Ribbon
Zuul
Eureka
Zipkin
© 2016 Pivotal Software, Inc. All rights reserved.
• Service Registry

Registry 

• 

" (host )" 

" " ( )
• Registry 

• Service Discovery
• Eureka (Netflix)
• Consul (HashiCorp)
• Zookeeper
Service Discovery
© 2016 Pivotal Software, Inc. All rights reserved.
• Service Registry 





• Netflix Ribbon
Client-side Load Balancing
© 2016 Pivotal Software, Inc. All rights reserved.
• 



( )
• 

(Open) 



(Half-Open) 

(Closed)
• Netflix Hystrix
•
Circuit Breaker
© 2016 Pivotal Software, Inc. All rights reserved.
• 

REST API 

• 

• Git/Subversion/

Distributed Configuration
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Boot
• Spring Cloud
• @EnableXxxServer
•
© 2016 Pivotal Software, Inc. All rights reserved.
Implement Config Server
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Create Config Server
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Create Config Server
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Config Server
spring.cloud.config.server.git.uri=https://github.com/
making/metflix-config.git
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Config Client
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Config Client
spring.cloud.config.uri=http://localhost:8888
spring.application.name=membership
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
Implement Service Registry
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Create Eureka Server
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Create Eureka Server
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Discovery Clients
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Create Eureka Client
@SpringBootApplication
@EnableDiscoveryClient
public class RecommendationsApplication {
public static void main(String[] args) {
SpringApplication.run(RecommendationsApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Create Eureka Client
@SpringBootApplication
@EnableDiscoveryClient
public class RecommendationsApplication {
public static void main(String[] args) {
SpringApplication.run(RecommendationsApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
Introduce Circuit Breaker
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Use Hystrix
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class RecommendationsApplication {
public static void main(String[] args) {
SpringApplication.run(RecommendationsApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Use Hystrix
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class RecommendationsApplication {
public static void main(String[] args) {
SpringApplication.run(RecommendationsApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Hystrix Command
@Component
public class RecommendationsService {
@HystrixCommand(fallbackMethod =
"recommendationFallback")
List<Movie> findRecommendationsForUser(String user) {
// some recommendation logic
}
List<Movie> recommendationFallback(String user) {
return top5Movies;
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Hystrix Command
@Component
public class RecommendationsService {
@HystrixCommand(fallbackMethod =
"recommendationFallback")
List<Movie> findRecommendationsForUser(String user) {
// some recommendation logic
}
List<Movie> recommendationFallback(String user) {
return top5Movies;
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Hystrix Command
@Component
public class RecommendationsService {
@HystrixCommand(fallbackMethod =
"recommendationFallback")
List<Movie> findRecommendationsForUser(String user) {
// some recommendation logic
}
List<Movie> recommendationFallback(String user) {
return top5Movies;
}
}
👈
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Configure Hystrix Command
@Component
public class RecommendationsService {
@HystrixCommand(fallbackMethod =
"recommendationFallback")
List<Movie> findRecommendationsForUser(String user) {
// some recommendation logic
}
List<Movie> recommendationFallback(String user) {
return top5Movies;
}
}
👈
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Implement Circuit Breaker Dashboard
© 2016 Pivotal Software, Inc. All rights reserved.
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
© 2016 Pivotal Software, Inc. All rights reserved.
Create Dashboard Server
@SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixDashboardApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
Create Dashboard Server
@SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixDashboardApplication.class,
args);
}
}
👈
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
Hystrix Dashboard
• 1 (=1 )
• Turbine
• Server-Sent Event pull PaaS
1URL
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Services
© 2016 Pivotal Software, Inc. All rights reserved.
"Spring Cloud as a Service"
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Boot
• Spring Cloud
• @EnableXxxServer
•
•
•
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Boot
• Spring Cloud
• @EnableXxxServer
•
•
•
• cf create-service
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Boot
• Spring Cloud
•
•
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Boot
• Spring Cloud
•
•
• Spring Boot
• Spring Cloud Services
•
• cf bind-service
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
🔒 🔒 🔒
© 2016 Pivotal Software, Inc. All rights reserved.
🔒 🔒 🔒
OAuth2
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
Create services
cf create-service p-config-server standard config-server 
-c '{"git":{"uri":"https://github.com/making/metflix-config"}}'
cf create-service p-service-registry standard eureka-server
cf create-service p-circuit-breaker-dashboard standard 
hystrix-dashboard
© 2016 Pivotal Software, Inc. All rights reserved.
Bind Services
cf bind-service membership config-server
cf bind-service recommendations config-server
cf bind-service ui config-server
cf bind-service membership eureka-server
cf bind-service recommendations eureka-server
cf bind-service ui eureka-server
cf bind-service recommendations hystrix-dashboard
cf bind-service ui hystrix-dashboard
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
© 2016 Pivotal Software, Inc. All rights reserved.
RabbitMQ push
!!
© 2016 Pivotal Software, Inc. All rights reserved.
• Spring Cloud r
• Spring Cloud Service = "Spring Cloud" as a service
• @EnableXxxServer --> cf create-service + OAuth2
© 2016 Pivotal Software, Inc. All rights reserved.
Links
• http://www.slideshare.net/SpringCentral/cloud-native-java-
with-spring-cloud-services
• https://github.com/Pivotal-Japan/cloud-native-workshop

More Related Content

What's hot

実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
Toshiaki Maki
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
Zachary Klein
 

What's hot (20)

Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
 
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsugFrom Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
 
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
 
Implement Service Broker with Spring Boot #cf_tokyo
Implement Service Broker with Spring Boot #cf_tokyoImplement Service Broker with Spring Boot #cf_tokyo
Implement Service Broker with Spring Boot #cf_tokyo
 
クラウド時代の Spring Framework (aka Spring Framework in Cloud Era)
クラウド時代の Spring Framework (aka Spring Framework in Cloud Era)クラウド時代の Spring Framework (aka Spring Framework in Cloud Era)
クラウド時代の Spring Framework (aka Spring Framework in Cloud Era)
 
手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務
 
Cloud Foundy Java Client V 2.0 #cf_tokyo
Cloud Foundy Java Client V 2.0 #cf_tokyoCloud Foundy Java Client V 2.0 #cf_tokyo
Cloud Foundy Java Client V 2.0 #cf_tokyo
 
Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot apps
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
 
Spring5 New Features - Nov, 2017
Spring5 New Features - Nov, 2017Spring5 New Features - Nov, 2017
Spring5 New Features - Nov, 2017
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?
 
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
 
Migrating to Git: Rethinking the Commit
Migrating to Git:  Rethinking the CommitMigrating to Git:  Rethinking the Commit
Migrating to Git: Rethinking the Commit
 
2017年のLINEのマイクロサービスを支えるSpring
2017年のLINEのマイクロサービスを支えるSpring2017年のLINEのマイクロサービスを支えるSpring
2017年のLINEのマイクロサービスを支えるSpring
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 

Similar to Spring Cloud Servicesの紹介 #pcf_tokyo

Product Release Webinar- WSO2 Developer Studio 3.5
Product Release Webinar- WSO2 Developer Studio 3.5Product Release Webinar- WSO2 Developer Studio 3.5
Product Release Webinar- WSO2 Developer Studio 3.5
WSO2
 

Similar to Spring Cloud Servicesの紹介 #pcf_tokyo (20)

今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k
 
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
 
How to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native ApplicationsHow to Architect and Develop Cloud Native Applications
How to Architect and Develop Cloud Native Applications
 
Building CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsBuilding CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless Applications
 
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer ToolsA Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
Spring Cloud Netflixを使おう #jsug
Spring Cloud Netflixを使おう #jsugSpring Cloud Netflixを使おう #jsug
Spring Cloud Netflixを使おう #jsug
 
Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #spri...
Data Microservices with Spring Cloud Stream, Task,  and Data Flow #jsug #spri...Data Microservices with Spring Cloud Stream, Task,  and Data Flow #jsug #spri...
Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #spri...
 
Leveraging the Latest OSGi R7 Specifications - C Ziegeler & D Bosschaert
Leveraging the Latest OSGi R7 Specifications - C Ziegeler & D BosschaertLeveraging the Latest OSGi R7 Specifications - C Ziegeler & D Bosschaert
Leveraging the Latest OSGi R7 Specifications - C Ziegeler & D Bosschaert
 
Manchester geek night pcf 101
Manchester geek night   pcf 101Manchester geek night   pcf 101
Manchester geek night pcf 101
 
Pivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical OverviewPivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical Overview
 
Pivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical OverviewPivotal Cloud Foundry: A Technical Overview
Pivotal Cloud Foundry: A Technical Overview
 
Product Release Webinar- WSO2 Developer Studio 3.5
Product Release Webinar- WSO2 Developer Studio 3.5Product Release Webinar- WSO2 Developer Studio 3.5
Product Release Webinar- WSO2 Developer Studio 3.5
 
The Fantastic Voyage to PaaS - Are we there yet? (Cloud Foundry Summit 2014)
The Fantastic Voyage to PaaS - Are we there yet? (Cloud Foundry Summit 2014)The Fantastic Voyage to PaaS - Are we there yet? (Cloud Foundry Summit 2014)
The Fantastic Voyage to PaaS - Are we there yet? (Cloud Foundry Summit 2014)
 
CI/CD with AWS Code Services
CI/CD with AWS Code ServicesCI/CD with AWS Code Services
CI/CD with AWS Code Services
 
Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM
 
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
Spring Framework 5.0による Reactive Web Application #JavaDayTokyoSpring Framework 5.0による Reactive Web Application #JavaDayTokyo
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
 
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten ZiegelerOSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s Story
 
Pivotal microservices spring_pcf_skillsmatter.pptx
Pivotal microservices spring_pcf_skillsmatter.pptxPivotal microservices spring_pcf_skillsmatter.pptx
Pivotal microservices spring_pcf_skillsmatter.pptx
 

More from Toshiaki Maki

マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
Toshiaki Maki
 
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3techConsumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Toshiaki Maki
 

More from Toshiaki Maki (14)

Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1tServerless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
 
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
 
Spring Boot Actuator 2.0 & Micrometer
Spring Boot Actuator 2.0 & MicrometerSpring Boot Actuator 2.0 & Micrometer
Spring Boot Actuator 2.0 & Micrometer
 
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpOpen Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjp
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
Zipkin Components #zipkin_jp
Zipkin Components #zipkin_jpZipkin Components #zipkin_jp
Zipkin Components #zipkin_jp
 
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
 
Short Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyoShort Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyo
 
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3techConsumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
 
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
 
Concourse CI Meetup Demo
Concourse CI Meetup DemoConcourse CI Meetup Demo
Concourse CI Meetup Demo
 
Install Concourse CI with BOSH
Install Concourse CI with BOSHInstall Concourse CI with BOSH
Install Concourse CI with BOSH
 
Introduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷JavaIntroduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷Java
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Spring Cloud Servicesの紹介 #pcf_tokyo

  • 1. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Services Toshiaki Maki (@making) PCF Meetup 2016-06-29
  • 2. © 2016 Pivotal Software, Inc. All rights reserved. Who am I ? • Toshiaki Maki (@making) • Sr. Solutions Architect • Spring Framework enthusiast Perfect Java EE (Coming Soon) bit.ly/spring-book
  • 3. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud
  • 4. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud • Omakase Microservices
  • 5. © 2016 Pivotal Software, Inc. All rights reserved. • Service Discovery • API Gateway • Client-side Load Balancing • Circuit Breakers • Distributed Configuration • Distributed Tracing Spring Cloud Provides Hystrix Ribbon Zuul Eureka Zipkin
  • 6. © 2016 Pivotal Software, Inc. All rights reserved. • Service Registry
 Registry 
 • 
 " (host )" 
 " " ( ) • Registry 
 • Service Discovery • Eureka (Netflix) • Consul (HashiCorp) • Zookeeper Service Discovery
  • 7. © 2016 Pivotal Software, Inc. All rights reserved. • Service Registry 
 
 
 • Netflix Ribbon Client-side Load Balancing
  • 8. © 2016 Pivotal Software, Inc. All rights reserved. • 
 
 ( ) • 
 (Open) 
 
 (Half-Open) 
 (Closed) • Netflix Hystrix • Circuit Breaker
  • 9. © 2016 Pivotal Software, Inc. All rights reserved. • 
 REST API 
 • 
 • Git/Subversion/
 Distributed Configuration
  • 10. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud
  • 11. © 2016 Pivotal Software, Inc. All rights reserved.
  • 12. © 2016 Pivotal Software, Inc. All rights reserved.
  • 13. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Boot • Spring Cloud • @EnableXxxServer •
  • 14. © 2016 Pivotal Software, Inc. All rights reserved. Implement Config Server
  • 15. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency>
  • 16. © 2016 Pivotal Software, Inc. All rights reserved. Create Config Server @SpringBootApplication @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } } 👈
  • 17. © 2016 Pivotal Software, Inc. All rights reserved. Create Config Server @SpringBootApplication @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } } 👈
  • 18. © 2016 Pivotal Software, Inc. All rights reserved. Configure Config Server spring.cloud.config.server.git.uri=https://github.com/ making/metflix-config.git
  • 19. © 2016 Pivotal Software, Inc. All rights reserved. Configure Config Client
  • 20. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency>
  • 21. © 2016 Pivotal Software, Inc. All rights reserved. Configure Config Client spring.cloud.config.uri=http://localhost:8888 spring.application.name=membership
  • 22. © 2016 Pivotal Software, Inc. All rights reserved.
  • 23. © 2016 Pivotal Software, Inc. All rights reserved. Implement Service Registry
  • 24. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency>
  • 25. © 2016 Pivotal Software, Inc. All rights reserved. Create Eureka Server @SpringBootApplication @EnableEurekaServer public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } } 👈
  • 26. © 2016 Pivotal Software, Inc. All rights reserved. Create Eureka Server @SpringBootApplication @EnableEurekaServer public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } } 👈
  • 27. © 2016 Pivotal Software, Inc. All rights reserved.
  • 28. © 2016 Pivotal Software, Inc. All rights reserved. Configure Discovery Clients
  • 29. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency>
  • 30. © 2016 Pivotal Software, Inc. All rights reserved. Create Eureka Client @SpringBootApplication @EnableDiscoveryClient public class RecommendationsApplication { public static void main(String[] args) { SpringApplication.run(RecommendationsApplication.class, args); } } 👈
  • 31. © 2016 Pivotal Software, Inc. All rights reserved. Create Eureka Client @SpringBootApplication @EnableDiscoveryClient public class RecommendationsApplication { public static void main(String[] args) { SpringApplication.run(RecommendationsApplication.class, args); } } 👈
  • 32. © 2016 Pivotal Software, Inc. All rights reserved.
  • 33. © 2016 Pivotal Software, Inc. All rights reserved. Introduce Circuit Breaker
  • 34. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> </dependency>
  • 35. © 2016 Pivotal Software, Inc. All rights reserved. Use Hystrix @SpringBootApplication @EnableDiscoveryClient @EnableCircuitBreaker public class RecommendationsApplication { public static void main(String[] args) { SpringApplication.run(RecommendationsApplication.class, args); } } 👈
  • 36. © 2016 Pivotal Software, Inc. All rights reserved. Use Hystrix @SpringBootApplication @EnableDiscoveryClient @EnableCircuitBreaker public class RecommendationsApplication { public static void main(String[] args) { SpringApplication.run(RecommendationsApplication.class, args); } } 👈
  • 37. © 2016 Pivotal Software, Inc. All rights reserved. Configure Hystrix Command @Component public class RecommendationsService { @HystrixCommand(fallbackMethod = "recommendationFallback") List<Movie> findRecommendationsForUser(String user) { // some recommendation logic } List<Movie> recommendationFallback(String user) { return top5Movies; } } 👈
  • 38. © 2016 Pivotal Software, Inc. All rights reserved. Configure Hystrix Command @Component public class RecommendationsService { @HystrixCommand(fallbackMethod = "recommendationFallback") List<Movie> findRecommendationsForUser(String user) { // some recommendation logic } List<Movie> recommendationFallback(String user) { return top5Movies; } } 👈
  • 39. © 2016 Pivotal Software, Inc. All rights reserved. Configure Hystrix Command @Component public class RecommendationsService { @HystrixCommand(fallbackMethod = "recommendationFallback") List<Movie> findRecommendationsForUser(String user) { // some recommendation logic } List<Movie> recommendationFallback(String user) { return top5Movies; } } 👈 👈
  • 40. © 2016 Pivotal Software, Inc. All rights reserved. Configure Hystrix Command @Component public class RecommendationsService { @HystrixCommand(fallbackMethod = "recommendationFallback") List<Movie> findRecommendationsForUser(String user) { // some recommendation logic } List<Movie> recommendationFallback(String user) { return top5Movies; } } 👈 👈
  • 41. © 2016 Pivotal Software, Inc. All rights reserved. Implement Circuit Breaker Dashboard
  • 42. © 2016 Pivotal Software, Inc. All rights reserved. Add dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId> </dependency>
  • 43. © 2016 Pivotal Software, Inc. All rights reserved. Create Dashboard Server @SpringBootApplication @EnableHystrixDashboard public class HystrixDashboardApplication { public static void main(String[] args) { SpringApplication.run(HystrixDashboardApplication.class, args); } } 👈
  • 44. © 2016 Pivotal Software, Inc. All rights reserved. Create Dashboard Server @SpringBootApplication @EnableHystrixDashboard public class HystrixDashboardApplication { public static void main(String[] args) { SpringApplication.run(HystrixDashboardApplication.class, args); } } 👈
  • 45. © 2016 Pivotal Software, Inc. All rights reserved.
  • 46. © 2016 Pivotal Software, Inc. All rights reserved.
  • 47. © 2016 Pivotal Software, Inc. All rights reserved. Hystrix Dashboard • 1 (=1 ) • Turbine • Server-Sent Event pull PaaS 1URL
  • 48. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Services
  • 49. © 2016 Pivotal Software, Inc. All rights reserved. "Spring Cloud as a Service"
  • 50. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Boot • Spring Cloud • @EnableXxxServer • • •
  • 51. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Boot • Spring Cloud • @EnableXxxServer • • • • cf create-service
  • 52. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Boot • Spring Cloud • •
  • 53. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Boot • Spring Cloud • • • Spring Boot • Spring Cloud Services • • cf bind-service
  • 54. © 2016 Pivotal Software, Inc. All rights reserved.
  • 55. © 2016 Pivotal Software, Inc. All rights reserved. 🔒 🔒 🔒
  • 56. © 2016 Pivotal Software, Inc. All rights reserved. 🔒 🔒 🔒 OAuth2
  • 57. © 2016 Pivotal Software, Inc. All rights reserved.
  • 58. © 2016 Pivotal Software, Inc. All rights reserved.
  • 59. © 2016 Pivotal Software, Inc. All rights reserved.
  • 60. © 2016 Pivotal Software, Inc. All rights reserved. Create services cf create-service p-config-server standard config-server -c '{"git":{"uri":"https://github.com/making/metflix-config"}}' cf create-service p-service-registry standard eureka-server cf create-service p-circuit-breaker-dashboard standard hystrix-dashboard
  • 61. © 2016 Pivotal Software, Inc. All rights reserved. Bind Services cf bind-service membership config-server cf bind-service recommendations config-server cf bind-service ui config-server cf bind-service membership eureka-server cf bind-service recommendations eureka-server cf bind-service ui eureka-server cf bind-service recommendations hystrix-dashboard cf bind-service ui hystrix-dashboard
  • 62. © 2016 Pivotal Software, Inc. All rights reserved.
  • 63. © 2016 Pivotal Software, Inc. All rights reserved.
  • 64. © 2016 Pivotal Software, Inc. All rights reserved.
  • 65. © 2016 Pivotal Software, Inc. All rights reserved. RabbitMQ push !!
  • 66. © 2016 Pivotal Software, Inc. All rights reserved. • Spring Cloud r • Spring Cloud Service = "Spring Cloud" as a service • @EnableXxxServer --> cf create-service + OAuth2
  • 67. © 2016 Pivotal Software, Inc. All rights reserved. Links • http://www.slideshare.net/SpringCentral/cloud-native-java- with-spring-cloud-services • https://github.com/Pivotal-Japan/cloud-native-workshop