问题标签 [spring-cloud-netflix]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
709 浏览

netflix-zuul - 使用 Eureka 的 ZUUL 动态路由

我有一个zuul预过滤器:

所以在这个过滤器中,我首先查看请求是否经过身份验证。如果没有,我想将其重定向到loginEureka 中的服务,然后在用户登录后,他应该被转发到他最初请求的服务。

ZUUL 配置如下:

基本上,我想知道如何在过滤器代码中使用 Eureka 进行路由。

编辑:

我认为更好的设计可能只是重定向到 zuul 本身:获取主机并附加/login。这样zuul里面的路由设置yml就会生效。我仍然想知道该怎么做,然后将请求转发到其原始目的地。

0 投票
1 回答
1544 浏览

netflix-zuul - 在zuul配置中处理多个微服务的相同上下文路径

我们正在 Spring netflix OSS 之上构建平台,以托管多个用例微服务 API。其中一个用例有 2 个 API(2 个代码库构建 2 个 jar),他们希望将其托管在 2 个不同的服务 ID 上,但两者都具有相同的上下文 URL,例如“/loan/card/v1/individual/”

AP11-> /credit_decision/payment_plan/

API2 -> /history_decision/payment_plan/

我应该如何配置路由路径,以便通过 url 来的任何呼叫

/loan/card/v1/individual/credit_decision/payment_plan/ 应该去 API1 和

/loan/card/v1/individual/history_decision/payment_plan/ 应该去 API2

0 投票
1 回答
6857 浏览

tdd - 试驾 Hystrix 断路器配置

我们的应用程序是通过使用 Hystrix 实现断路器模式以防脆弱的方式编写的。

整个应用程序是使用测试驱动的实践创建的,但是我们需要通过在方法上配置相同的方法来实现断路器策略。

以下是我们使用的示例配置 -

如果有可用的功能或机会在我的集成测试中测试驱动它(加载整个 WebApplicationContext,因此知道应用程序可用的所有配置),任何人都可以发表评论吗?

或者,如果这根本不可能在我的应用程序上下文中得到验证?

任何输入都是有价值的。

0 投票
2 回答
3095 浏览

spring-cloud - Spring Cloud:如何在@FeignClient 中配置Hystrix

我有以下服务:

如何更改默认超时和线程池大小?

0 投票
1 回答
657 浏览

netflix - 不推荐使用 Hystrix 方法

我正在使用 hystrix api 版本 1.5.4。我看到该方法 withExecutionIsolationThreadTimeoutInMilliseconds已被弃用。替代方法是什么?

0 投票
2 回答
1100 浏览

spring-cloud - Spring Cloud Netflix: Remote service error handling with Feign

We are trying to put Spring Cloud Netflix into production environment. For now we encounter a problem about business logic error handling.

We're using Feign as HTTP REST client. Microservice A needs to invoke microservice B which is deployed in different JVM(or physical server). Microservice B may return some error message which belongs to business. For instance A needs to query order information from B but the order ID may not exist so B has to return the error message that tells A this order doesn't exist. A has to do if-else judgement from the return message to determine if there are erorrs, then code will be like the following snippet:

There are so many if-else so that it's not graceful enough. What we want is remoteServieA.foo() can throw a self-defined runtime exception such as OrderNotExistException. Any idea to achieve this goal?

0 投票
1 回答
5108 浏览

spring-cloud - Spring Cloud Zuul 网关 401 基础认证

我正在开发一个 Spring Cloud Zuul 网关,放在我的 Spring Boot 应用程序前面。我在应用程序端使用基本授权。当我使用正确的授权标头调用网关时,我总是得到 401 Unauthorized

但是当我直接向应用程序发出请求时,它可以工作。

0 投票
1 回答
352 浏览

netflix-eureka - Spring Cloud Netflix:Eureka 客户端会更喜欢选择同区的远程服务吗?

文件说:

Eureka 客户端尝试与同一区域中的 Eureka Server 通信。如果与服务器通信时出现问题,或者如果服务器不在同一区域中,则客户端将故障转移到其他区域中的服务器。

所以我知道客户端会首先查询同一区域的服务器。但我的问题是客户会更喜欢在同一个区域选择远程服务吗?不同的区域可以映射到不同的服务器机房,因此跨区域的 RPC 可能会带来更多的网络延迟。

0 投票
2 回答
5753 浏览

spring-boot - java.lang.IllegalStateException:没有可用于 ip 的实例

下面是我的 bom 微服务:

上面的微服务正在尝试对另一个微服务进行休息调用,部分微服务:

我得到以下异常:

Eureka、BOM 和 Part 微服务部署在 azure 上。Eureka 注册了微服务,并且我可以使用“/service-instances/plm-part-ms”在 bom 微服务中分割微服务细节,其中“plm-part-ms”是部分微服务的 Spring 应用程序名称。任何帮助将不胜感激 !

0 投票
1 回答
6291 浏览

netflix-eureka - Spring Boot eureka - 删除死服务

我正在研究 Eureka 以进行服务发现,我发现如果我杀死一个进程,eureka 会将其显示为“DOWN”。有一天它会自己清洗并移除它吗?

场景是这样的:假设我正在使用亚马逊 AWS。我想以这种方式上传新版本:准备 X 台新机器并杀死旧机器。

新机器在启动时会注册到eureka,但是旧机器如何从Eureka注销呢?

我使用java和spring-cloud。

谢谢,伊多