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
Conversation
@@ -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"; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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://"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support all transport,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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]+://.+"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles
, where you replaceSCB-XXX
with the appropriate JIRA issue.mvn clean install
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.