Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCB-967] Support configed IP send request #960

Merged
merged 3 commits into from Oct 23, 2018

Conversation

weichao666
Copy link
Contributor

@weichao666 weichao666 commented Oct 17, 2018

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@@ -61,6 +66,8 @@
public class LoadbalanceHandler implements Handler {
public static final String CONTEXT_KEY_SERVER_LIST = "x-context-server-list";

public static final String SERVICECOMB_SERVER_ENDPOINT = "servicecomb-server-endpoint";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use shorter name?
eg: scb-endpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -167,6 +175,17 @@ private void preCheck() {

@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
String endpointUri = invocation.getLocalContext(SERVICECOMB_SERVER_ENDPOINT);
if (endpointUri != null) {
boolean isRest = endpointUri.startsWith("rest://");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need to limit to rest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support all transport,done

@coveralls
Copy link

coveralls commented Oct 17, 2018

Coverage Status

Coverage decreased (-0.009%) to 86.395% when pulling 26eb46b on weichao666:endpoint into 56d8899 on apache:master.

@@ -167,6 +176,23 @@ private void preCheck() {

@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
String endpointUri = invocation.getLocalContext(SERVICECOMB_SERVER_ENDPOINT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.sorry, i forgot a requirement:
need a configuration, default to disable this feature
2.extrace the new logic to a method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -167,6 +176,23 @@ private void preCheck() {

@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
String endpointUri = invocation.getLocalContext(SERVICECOMB_SERVER_ENDPOINT);
if (endpointUri != null) {
String endpointRule = "[a-z]+://.+";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URI will check this automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, delete this, and have test in ut

"the endpoint's format of the configuration is incorrect, e.g rest://127.0.0.1:8080");
}
URI formatUri = new URI(endpointUri);
Transport transport = CseContext.getInstance().getTransportManager().findTransport(formatUri.getScheme());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use CseContext anymore, change to ScbEngine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

public static final String SERVICECOMB_SERVER_ENDPOINT = "scb-endpoint";

public static final boolean supportConfigEndpoint =
DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.configEndpoint.enabled", false).get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use: servicecomb.loadbalance.userDefinedEndpoint.enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@liubao68 liubao68 merged commit 0e227f6 into apache:master Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants