Skip to content

Commit 7dfabe4

Browse files
readme update
1 parent 76b3bee commit 7dfabe4

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,17 @@ public interface HttpApi3 {
174174

175175
### HTTP calls between microservices
176176

177-
**By configuring the `serviceId` and `path` properties of `@Retrofit`, HTTP calls between microservices can be realized. Users need to implement the `ServiceInstanceChooser` interface by themselves, complete the selection logic of the service instance, and configure it as the `Bean` of the `Spring` container**.
177+
**By configuring the `serviceId` and `path` properties of `@Retrofit`, HTTP calls between microservices can be realized**.
178+
179+
```java
180+
@RetrofitClient(serviceId = "${jy-helicarrier-api.serviceId}", path = "/m/count", errorDecoder = HelicarrierErrorDecoder.class)
181+
@Retry
182+
public interface ApiCountService {
183+
184+
}
185+
```
186+
187+
Users need to implement the `ServiceInstanceChooser` interface by themselves, complete the selection logic of the service instance, and configure it as the `Bean` of the `Spring` container.
178188
For `Spring Cloud` applications, `retrofit-spring-boot-starter` provides the implementation of `SpringCloudServiceInstanceChooser`.
179189

180190
```java

README_CN.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,17 @@ public interface HttpApi3 {
172172

173173
### 微服务之间的HTTP调用
174174

175-
**通过配置`@Retrofit`的`serviceId`和`path`属性,可以实现微服务之间的HTTP调用**。用户需要自行实现`ServiceInstanceChooser`接口,完成服务实例的选取逻辑,并将其配置成`Spring`容器的`Bean`。对于`Spring Cloud`应用,`retrofit-spring-boot-starter`提供了`SpringCloudServiceInstanceChooser`实现。
175+
**通过配置`@Retrofit`的`serviceId`和`path`属性,可以实现微服务之间的HTTP调用**。比如:
176+
177+
```java
178+
@RetrofitClient(serviceId = "${jy-helicarrier-api.serviceId}", path = "/m/count", errorDecoder = HelicarrierErrorDecoder.class)
179+
@Retry
180+
public interface ApiCountService {
181+
182+
}
183+
```
184+
185+
用户需要自行实现`ServiceInstanceChooser`接口,完成服务实例的选取逻辑,并将其配置成`Spring`容器的`Bean`。对于`Spring Cloud`应用,`retrofit-spring-boot-starter`提供了`SpringCloudServiceInstanceChooser`实现。
176186

177187
```java
178188
public interface ServiceInstanceChooser {

0 commit comments

Comments
 (0)