服务远程调用
1.常量类:代表那个模块
public interface ServiceNameConstants {
/**
* 认证中心
*/
String AUTH_SERVICE = "zxmap-auth";
/**
* UMPS模块
*/
String UPMS_SERVICE = "zxmap-upms-biz";
/**
* 分布式事务协调服务
*/
String TX_MANAGER = "zxmap-tx-manager";
/**
* 数据服务
* */
String DATA_SERVICE = "zxmap-data-biz";
/**
* 服务发布
* */
String PUBLISH_SERVICE="zxmap-publish-biz";
/**
* 地图服务
* */
String MAP_SERVICE="zxmap-map-biz";
}
2.feign接口暴露方法(controller的方法)
@FeignClient(contextId = "remoteService", value = ServiceNameConstants.PUBLISH_SERVICE)
public interface RemoteService {
@GetMapping("/service/serviceTileJson/{mapId}/{serviceId}")
String serviceTileJsonFromMap(@PathVariable("serviceId") @NotNull(message = "serviceId不能为空") String serviceId, @PathVariable("mapId") String mapId);
@GetMapping("/service/serviceTileJson/{serviceId}")
String serviceTileJson(@PathVariable("serviceId") @NotNull(message = "serviceId不能为空") String serviceId);
}
3.远程调用: