微服务访问一般流程

微服务访问链路流程:

1、一个前端的界面入口普通链接(调用微服务)

http://yuanqudev1.xx.com/evh/meeting/listMyMeetings(系统普通链接)


2、请求来到Nginx(配置访问转发到的地址,这里是gateway、系统的唯一入口)

    location /evh/ {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Scheme $scheme;
        proxy_pass http://localhost:8780;
    }

3、gateway routes路由配置,

      - id: officeauto-api
        order: 0
        uri: lb://officeauto
        predicates:
        - Path=/evh/meeting/**
        filters:
        - RewritePath=/evh/(?.*), /officeauto/$\{segment}

经过网关路由变为:http://yuanqudev1.xx.com/officeauto/meeting/listMyMeetings

INFO  [com.everhomes.gateway.GlobalFilters] - Session [2593880688374212] 
Request uri=http://yuanqudev1.xx.com/officeauto/meeting/listMyMeetings, 
Response code=200

4、Eureka上找到服务,访问到服务

 [/officeauto/meeting/listMyMeetings] - Response content: {"version":"1.0.0","errorCode":200,"errorDescription":"OK",
 "response":{"totalNum":2,"dtos":[{"id":13,"subject":"1234","content":"","meetingDate":1587312000000,"expectBeginTime":39600000,
 "expectEndTime":40500000,"sponsorUserId":505361,"sponsorDetailId":39863,"status":3,"showStatus":"已结束",
 "attachmentFlag":0,"onlineMeetingApp":"","onlineMeetingNO":"","meetingLocation":"","expectBeginTimestamp":1587351600000,"expectEndTimestamp":1587352500000,
 "meetingManagerUserId":505361,"meetingManagerDetailId":39863},{"id":14,"subject":"2345","content":"","meetingDate":1587312000000,"expectBeginTime":39600000,
 "expectEndTime":40500000,"sponsorUserId":505361,"sponsorDetailId":39863,"status":3,"showStatus":"已结束","attachmentFlag":0,"onlineMeetingApp":"",
 "onlineMeetingNO":"","meetingLocation":"","expectBeginTimestamp":1587351600000,"expectEndTimestamp":1587352500000,"meetingManagerUserId":505361,"meetingManagerDetailId":39863}]}}

 

每天努力一点,每天都在进步

你可能感兴趣的:(SpringCloud,微服务访问,微服务拆分,微服务调用流程)