-
Notifications
You must be signed in to change notification settings - Fork 792
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
Modify the documentation about the Telnet command to match the code impl… #200
Conversation
@beiwei30 would you mind to review this pr? |
0. `invoke XxxService.xxxMethod({"prop": "value"})`: invoke particular method for the given service | ||
0. `invoke xxxMethod({"prop": "value"})`: invoke particular method for the default service | ||
0. `invoke xxxService.xxxMethod("paramStr")`或`invoke xxxService.xxxMethod(18)`: invoke particular method with a primitive type parameter | ||
0. `invoke xxxService.xxxMethod("paramStr") -p java.lang.String`: invoke particular method with a String type parameter |
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.
I ran the following command on latest 2.7.x branch and got following error
dubbo>invoke org.apache.dubbo.demo.DemoService.sayHello("hello") -p java.lang.String
Invalid parameters, format: service.method(args)
It looks like -p java.lang.String
does not work. How did you get it to work?
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.
I ran the following command on latest 2.7.x branch and got following error
dubbo>invoke org.apache.dubbo.demo.DemoService.sayHello("hello") -p java.lang.String Invalid parameters, format: service.method(args)
It looks like
-p java.lang.String
does not work. How did you get it to work?
I have made more test on the latest master branch.My test is as the following:
package org.apache.dubbo.demo;
public class Student {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
package org.apache.dubbo.demo;
public interface DemoService {
String sayHello(String name);
String sayHello(Long name);
String sayHello(Integer age);
String sayHello(Student student);
String sayHello(String name, Integer age);
}
package org.apache.dubbo.demo.provider;
import org.apache.dubbo.demo.DemoService;
import org.apache.dubbo.demo.Student;
import org.apache.dubbo.rpc.RpcContext;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DemoServiceImpl implements DemoService {
@Override
public String sayHello(String name) {
System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
}
@Override
public String sayHello(Long name) {
return "Long from sayHello " + name;
}
@Override
public String sayHello(Integer age) {
return "int from sayHello " + age;
}
@Override
public String sayHello(Student student) {
return "Student from sayHello ,name:" + student.getName() + ",age:" + student.getAge();
}
@Override
public String sayHello(String name, Integer age) {
return "name and age from sayHello,name:" + name + ",age" + age;
}
}
And based on your result,the error message from org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java:158
if (i < 0 || !message.endsWith(")")) {
return "Invalid parameters, format: service.method(args)";
}
it may indicate something wrong with the input parentheses or the following class
org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java
different from the master branch
.Would you maind to take a look at this and provide more detail about your test?
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.
Hi, sorry for the late reply, I am going to try it out in next few days.
close since the -p feature has beed removed in this pr Refactor telnet invoke command |
…ementation
What is the purpose of the change
Modify the documentation of the Telnet command to match the code implementation
Brief changelog
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.docsite start
, and make sure it works as expected.