Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
BUILDING
MICROSERVICES
WITH
SPRING CLOUD
AND
NETFLIX OSS
AGENDA
- Config Server
- Config Client
- Bus
- Eureka Server
- Eureka Client
- Zuul
- Feign
- Hystrix
- Hystrix Dashboard
Client
CC
EC
ZUUL
GATEWAY API
CONFIG
SERVER
EC
FEIGN
EC
INVOICE
SERVICE
CC
SERVICE
DISCOVE
RY
ES
HYSTRIX
DASHBOARD
FEIGN
E...
Service Discovery
- Maintains registry of clients with metadata
- Heartbeats (default 30 seconds)
- Dashboard
- Host/Port
...
Service Discovery
Application.java
@SpringBootApplication
@EnableEurekaServer
public class ServiceDiscoveryApplication {
p...
Service Discovery
bootstrap.yml
spring:
application:
name: service-discovery
server.port: ${PORT:8761}
eureka:
instance.ho...
DEMO
Config Server
Config Server
Resource Format
- /{application}/{profile}/{label}
- /{application}-{profiles}.yml
- /{label}/{application}-...
Config Server
Application.java
@SpringBootApplication
@EnableConfigServer
@EnableEurekaClient
public class ConfigServerApp...
spring:
application.name: config-server
cloud.config:
server.git.uri: https://github.com/semihhakkioglu/spring-cloud-micro...
DEMO
Gateway API
Zuul
- Filtering
- Load Balancing
- Provides single point of entry to service
- By default creates route for a...
Gateway API
Application.java
@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
public class GatewayApiApplicatio...
Gateway API
bootstrap.yml
spring:
application:
name: gateway-api
cloud.config:
discovery.service-id: config-server
label: ...
Gateway API
gateway-api.yml
ribbon:
ReadTimeout: 20000
ConnectTimeout: 20000
zuul:
routes:
ignoredService: '*'
invoice-ser...
DEMO
Services
Application.java
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableCircuitBreaker
public clas...
Services
bootstrap.yml
spring:
application:
name: invoice-service
cloud.config:
discovery.service-id: config-server
label:...
DEMO
Hystrix Dashboard
Application.java
@SpringBootApplication
@EnableHystrixDashboard
@EnableEurekaClient
public class Hystrix...
Hystrix Dashboard
bootstrap.yml
spring.application.name: hystrix-dashboard
server.port: ${PORT:8010}
eureka:
instance:
hos...
DEMO
Semih HAKKIOĞLU
https://github.com/semihhakkioglu/spring-cloud-microservice-example
https://github.com/semihhakkioglu/spri...
Upcoming SlideShare
Loading in …5
×

Building Microservices with Spring Cloud and Netflix OSS

961 views

Published on

Source code:
https://github.com/semihhakkioglu/spring-cloud-microservice-example

https://github.com/semihhakkioglu/spring-cloud-microservice-config

Published in: Software
  • The final result was amazing, and I highly recommend ⇒ www.HelpWriting.net ⇐ to anyone in the same mindset as me.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Building Microservices with Spring Cloud and Netflix OSS

  1. 1. BUILDING MICROSERVICES WITH SPRING CLOUD AND NETFLIX OSS
  2. 2. AGENDA - Config Server - Config Client - Bus - Eureka Server - Eureka Client - Zuul - Feign - Hystrix - Hystrix Dashboard
  3. 3. Client CC EC ZUUL GATEWAY API CONFIG SERVER EC FEIGN EC INVOICE SERVICE CC SERVICE DISCOVE RY ES HYSTRIX DASHBOARD FEIGN EC CC MERCHANT SERVICE
  4. 4. Service Discovery - Maintains registry of clients with metadata - Heartbeats (default 30 seconds) - Dashboard - Host/Port - Health indicator url
  5. 5. Service Discovery Application.java @SpringBootApplication @EnableEurekaServer public class ServiceDiscoveryApplication { public static void main(String[] args) { SpringApplication.run(ServiceDiscoveryApplication.class, args); } }
  6. 6. Service Discovery bootstrap.yml spring: application: name: service-discovery server.port: ${PORT:8761} eureka: instance.hostname: localhost client: registerWithEureka: false fetchRegistry: false serviceUrl.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  7. 7. DEMO
  8. 8. Config Server
  9. 9. Config Server Resource Format - /{application}/{profile}/{label} - /{application}-{profiles}.yml - /{label}/{application}-{profiles}.yml - /{application}-{profiles}.properties - /{label}/{application}-{profiles}.properties
  10. 10. Config Server Application.java @SpringBootApplication @EnableConfigServer @EnableEurekaClient public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } }
  11. 11. spring: application.name: config-server cloud.config: server.git.uri: https://github.com/semihhakkioglu/spring-cloud-microservice-config label: develop security.basic.enabled: false management.security.enabled: false server.port: ${PORT:8888} eureka: instance.hostname: localhost client.serviceUrl.defaultZone: http://localhost:8761/eureka/ Config Server bootstrap.yml
  12. 12. DEMO
  13. 13. Gateway API Zuul - Filtering - Load Balancing - Provides single point of entry to service - By default creates route for all registered service in Eureka Server - http://localhost:8080/merchant-service routes to merchant- service
  14. 14. Gateway API Application.java @SpringBootApplication @EnableZuulProxy @EnableEurekaClient public class GatewayApiApplication { public static void main(String[] args) { SpringApplication.run(GatewayApiApplication.class, args); } }
  15. 15. Gateway API bootstrap.yml spring: application: name: gateway-api cloud.config: discovery.service-id: config-server label: develop server.port: ${PORT:8080} eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
  16. 16. Gateway API gateway-api.yml ribbon: ReadTimeout: 20000 ConnectTimeout: 20000 zuul: routes: ignoredService: '*' invoice-service: path: /invoices/** serviceId: invoice-service stripPrefix: false merchant-service: path: /merchants/** serviceId: merchant-service stripPrefix: true
  17. 17. DEMO
  18. 18. Services Application.java @SpringBootApplication @EnableEurekaClient @EnableFeignClients @EnableCircuitBreaker public class InvoiceServiceApplication { public static void main(String[] args) { SpringApplication.run(InvoiceServiceApplication.class, args); } }
  19. 19. Services bootstrap.yml spring: application: name: invoice-service cloud.config: discovery.service-id: config-server label: develop server.port: ${PORT:9090} eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
  20. 20. DEMO
  21. 21. Hystrix Dashboard Application.java @SpringBootApplication @EnableHystrixDashboard @EnableEurekaClient public class HystrixDashboardApplication { public static void main(String[] args) { SpringApplication.run(HystrixDashboardApplication.class, args); } }
  22. 22. Hystrix Dashboard bootstrap.yml spring.application.name: hystrix-dashboard server.port: ${PORT:8010} eureka: instance: hostname: localhost client: registerWithEureka: true fetchRegistry: true serviceUrl: defaultZone: http://localhost:8761/eureka/
  23. 23. DEMO
  24. 24. Semih HAKKIOĞLU https://github.com/semihhakkioglu/spring-cloud-microservice-example https://github.com/semihhakkioglu/spring-cloud-microservice-config THANK YOU

×