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

fix the consumer remoteApplication is null #12635

Merged
merged 4 commits into from
Jul 2, 2023

Conversation

xixingya
Copy link
Contributor

What is the purpose of the change

#12631

Brief changelog

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • [x ] Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.
    fix the consumer remoteApplicationName is null

@xixingya
Copy link
Contributor Author

fix #12631

@xixingya xixingya force-pushed the feature/230630-fix branch from 47f95f1 to ac7d7d9 Compare June 30, 2023 14:00
Comment on lines 203 to 208
public void setUrl(URL url) {
this.url = url;
if (url.getSide().equals(CommonConstants.CONSUMER)) {
this.remoteApplicationName = url.getRemoteApplication();
this.setRemoteAddress(url.getHost(), url.getPort());
}
Copy link
Member

Choose a reason for hiding this comment

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

image

Set remote attribute in org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker#invokeWithContext would be a better choice.

    private static void setRemote(Invoker<?> invoker, Invocation invocation) {
        invocation.addInvokedInvoker(invoker);
        RpcContext.getServiceContext().setRemoteAddress(invoker.getUrl().toInetSocketAddress());
        RpcContext.getServiceContext().setRemoteApplicationName(invoker.getUrl().getRemoteApplication());
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlbumenJ hello, I have fix them,and I run the local test on filter can get them

@@ -107,8 +107,6 @@ protected Result doInvoke(final Invocation invocation) throws Throwable {

invocation.setAttachment(TIMEOUT_KEY, String.valueOf(timeout));

RpcContext.getServiceContext().setRemoteAddress(currentClient.getRemoteAddress());
Copy link
Member

Choose a reason for hiding this comment

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

image

Check style should be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks,I will fix

@xixingya xixingya force-pushed the feature/230630-fix branch from 14dc66f to 3a0c31f Compare July 1, 2023 16:02
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@AlbumenJ
Copy link
Member

AlbumenJ commented Jul 2, 2023

LGTM. Thx your contributions~

@AlbumenJ AlbumenJ merged commit 94e7244 into apache:3.2 Jul 2, 2023
@xixingya
Copy link
Contributor Author

xixingya commented Jul 3, 2023

@AlbumenJ hello, did dubbo have a ding talk group,I have send a email to you,the qr code on the https://cn.dubbo.apache.org/zh-cn/contact/ is invalid

@AlbumenJ
Copy link
Member

AlbumenJ commented Jul 3, 2023

@AlbumenJ hello, did dubbo have a ding talk group,I have send a email to you,the qr code on the https://cn.dubbo.apache.org/zh-cn/contact/ is invalid

You can add my dingtak directly. albumenj

@sadeychai
Copy link

@AlbumenJ 3.1.8也遇到此问题,3.1.x是否有修复计划?

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.

3 participants