比如我当前项目需要调用一个php或者node的接口,怎么把这个服务整合到当前java的微服务中呢。
源码下载路径在:https://download.youkuaiyun.com/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模块里调用了这个接口,我就不再辞赘述了