netflix-eureka

Mock an Eureka Feign Client for Unittesting

痞子三分冷 提交于 2019-11-29 12:36:26
问题 i am using spring cloud's eureka and feign to communicate between some services (lets say A and B). Now id like to unittest my service layer of a single service (A). The problem is, that this service (A) is using a feign client to request some information of the other service (B). Running the unittests without any special configuration throws the following exception: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client:

Eureka peers not synchronized

亡梦爱人 提交于 2019-11-29 02:33:37
I'm prototyping a set of Spring Cloud + Netflix OSS applications and have run into trouble with Eureka. In our setup, we have a Spring Cloud Config Server + Eureka Server, and then 2 modules that utilize that server component for bootstrapping and service discovery. The problem I run into is that if I spin up 2 instances of the Eureka Server and try to pair them (based on the Two Peer Aware Eureka Servers in the docs ) they don't synchronize with each other. See configs below and/or the code on GitHub . Essentially, Peer1 starts up and looks fine. Peer2 will startup and look fine, with both

Strategy for unit testing a Spring Cloud Service

有些话、适合烂在心里 提交于 2019-11-29 01:57:51
问题 Given the following Spring Cloud setup: A data-service with access to a database, an eureka-service to handle service registry and discovery and a third service business-service which will be one of various services which encapsulate business cases. Unit testing the data-service is no problem, I just turn off eureka via eureka.client.enabled=false and use an in-memory database for my tests. To access the data-service from business-service , I'm using an @FeignClient("data-service") annotated

Eureka never unregisters a service

时光总嘲笑我的痴心妄想 提交于 2019-11-29 00:25:58
问题 I'm currently facing an issue where Eureka does not unregister a registered service. I've pulled the Eureka server example straight from git hub and made only one change, eureka.enableSelfPreservation = false . My application.yml looks like this: server: port: 8761 eureka: enableSelfPreservation: false client: registerWithEureka: false fetchRegistry: false server: waitTimeInMsWhenSyncEmpty: 0 I've read that if 85% of the registered services stop delivering heartbeats within 15 minutes, Eureka

How to selectively disable Eureka discovery client with Spring?

纵然是瞬间 提交于 2019-11-28 08:24:40
Is there a way to disable spring-boot eureka client registration based on the spring profile? Currently I use the following annotations: @Configuration @EnableAutoConfiguration @EnableDiscoveryClient @EnableConfigServer public class ConfigApplication { public static void main(String[] args) { SpringApplication.run(ConfigApplication.class, args); } } What I need is either a conditional such as (excuse the pseudo code) @if (Profile!="development") @EnableDiscoveryClient @endif Or some way in the application properties file. I have tried setting application.yml file as: spring: profiles:

Eureka and Kubernetes

☆樱花仙子☆ 提交于 2019-11-28 03:35:23
I am putting together a proof of concept to help identify gotchas using Spring Boot/Netflix OSS and Kubernetes together. This is also to proove out related technologies such as Prometheus and Graphana. I have a Eureka service setup which is starting with no trouble within my Kubernetes clouster. This is named discovery and has been given the name "discovery-1551420162-iyz2c" when added to K8 using kubectl run discovery --image=xyz/discovery-microservice --replicas=1 --port=8761 For my config server, I am trying to use Eureka based on a logical URL so in my bootstrap.yml I have server: port:

Eureka service discovery without Spring-boot

安稳与你 提交于 2019-11-27 21:34:15
I have written a spring boot micro-service and a REST client. The client is a part of another module and make RESTful calls to the micro-service. The micro-service registers with the Eureka registry and I want my client (Which is not a spring boot project) to use the Eureka to query and get the service endpoints. My problem is since the client is not a Spring-Boot applications I can not use the annotations like @SpringBootApplication , @EnableDiscoveryClient and the DiscoveryClient is not get auto wired to the application. Is there anyway to manually auto-wire the DiscoveryClient bean to the

How to override Spring Cloud Eureka default discovery client default ssl context?

不问归期 提交于 2019-11-27 19:04:29
问题 I'm trying to enable https for spring cloud eureka server. Yaml config: server: port: 8100 ssl: clientAuth: want protocol: TLS key-store: classpath:keystore/keystore.jks key-store-password: some key-password: some eureka: instance: prefer-ip-address: true non-secure-port-enabled: false secure-port-enabled: true secure-port: ${server.port} healthCheckUrl: https://${eureka.hostname}:${secure-port}/health statusPageUrl: https://${eureka.hostname}:${secure-port}/info homePageUrl: https://${eureka

Eureka service discovery without Spring-boot

大憨熊 提交于 2019-11-27 04:32:16
问题 I have written a spring boot micro-service and a REST client. The client is a part of another module and make RESTful calls to the micro-service. The micro-service registers with the Eureka registry and I want my client (Which is not a spring boot project) to use the Eureka to query and get the service endpoints. My problem is since the client is not a Spring-Boot applications I can not use the annotations like @SpringBootApplication , @EnableDiscoveryClient and the DiscoveryClient is not get

Creating custom Zuul filters

怎甘沉沦 提交于 2019-11-27 02:59:17
问题 I want to implement custom filters for my Zuul proxy. Now, I know there has been a lot of talking about that subject here and I took a look at the answer provided, with the examples of filters and the Spring Cloud documentation, which I went through several times. I have tried to copy some of the filters content to my use, but it didn't work. I have a Eureka server, registering 3 separate services, one of them being the front door to the other two, collecting information from each of them and