Spring Cloud Sidecar

Source: Internet
Author: User

Article transferred from https://www.cnblogs.com/waterlufei/p/7145746.html

Official Https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.5.RELEASE/multi/multi__polyglot_support _with_sidecar.html

With Spring Cloud Sidecar's integrated heterogeneous language, did not take notes before, now do because of various pits and wasted a day, here to remember

First is official website: http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.1.RELEASE/

The official website said Sidecar is very simple, how to do here do not remember, just add the package, and then in the main function above the annotation, and then write something in the configuration file, and then crossing network on the line, here to remember what the official website did not mention

1.sidecar is used to integrate heterogeneous languages, such as you write with Python,nodejs and so on, sidecar this service must and Python or Nodejs and other heterogeneous language services on the same host, which means that they are localhost, Can't be IP access and so on

2.sidecar Check the health address of heterogeneous languages the results are:

{
"Status": "Up"
}

Here we need to note that this JSON result is not directly written by us, several times I was to facilitate directly in the return of the data written, if you start Sidecar, you will find that the registry sidecar has been down, that is because your response The header is not changed, so we can send the data to map, how to use the JSON packet into JSON data, the other way is also possible. In fact, the principle is response header inside parsing text/html, we should change to Application/json, if you really want to write a JSON data directly, it is necessary to change the response header of this interface, This is no trouble in one or two words.

3. Done we can access the interface of the heterogeneous language through the service name, walk the gateway, directly through the service name access is possible

Spring Cloud Sidecar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.