比如我當前項目需要調用一個php或者node的接口,怎麼把這個服務整合到當前java的微服務中呢。
源碼下載路徑在:https://download.csdn.net/download/qq_22075041/10869452,代碼參考microservice-sidecar模塊
pom文件
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-sidecar</artifactId>
</dependency>
啓動類加一個組合註解:@EnableSidecar,配置文件配置一下暴露的異構服務節點
sidecar:
port: 8060 # Node.js微服務的端口
health-uri: http://localhost:8060/health.json # Node.js微服務的健康檢查URL
====================================
我在microservice-sidecar-client-ribbon模塊裏調用了這個接口,我就不再辭贅述了