Browse Source

rpc

pull/3/MERGE
CalvinKirs 4 years ago
parent
commit
6fafcc2f0c
  1. 15
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/IUserService.java
  2. 2
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/MainTest.java
  3. 7
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/UserService.java
  4. 2
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/base/Rpc.java
  5. 10
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/client/ConsumerConfig.java
  6. 1
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/client/ConsumerInterceptor.java
  7. 2
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/common/ConsumerConfigConstants.java

15
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/IUserService.java

@ -1,15 +0,0 @@
package org.apache.dolphinscheduler.remote.rpc;
import org.apache.dolphinscheduler.remote.rpc.base.Rpc;
/**
* @author jiangli
* @date 2021-01-11 21:05
*/
public interface IUserService {
@Rpc(async = true,callback = UserCallback.class)
Boolean say(String sb);
String hi(int num);
}

2
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/MainTest.java

@ -22,7 +22,7 @@ public class MainTest {
Host host = new Host("127.0.0.1", 12636);
IRpcClient rpcClient = new RpcClient();
IUserService userService = rpcClient.create(UserService.class, host);
UserService userService = rpcClient.create(UserService.class, host);
boolean result = userService.say("calvin");
System.out.println("异步回掉成功" + result);

7
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/UserService.java

@ -6,14 +6,13 @@ import org.apache.dolphinscheduler.remote.rpc.base.Rpc;
* @author jiangli
* @date 2021-01-11 21:05
*/
public class UserService implements IUserService {
@Override
@Rpc(async = true, callback = UserCallback.class, retries = 9999, isOneway = false)
public class UserService {
@Rpc(async = true, callback = UserCallback.class, retries = 9999)
public Boolean say(String s) {
return true;
}
@Override
public String hi(int num) {
return "this world has " + num + "sun";
}

2
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/base/Rpc.java

@ -18,8 +18,6 @@ public @interface Rpc {
boolean async() default false;
boolean isOneway() default true;
Class<? extends AbstractRpcCallBack> callback() default AbstractRpcCallBack.class;
}

10
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/client/ConsumerConfig.java

@ -14,8 +14,6 @@ public class ConsumerConfig {
private Boolean async = ConsumerConfigConstants.DEFAULT_SYNC;
private Boolean isOneway = ConsumerConfigConstants.DEFAULT_IS_ONEWAY;
private Integer retries = ConsumerConfigConstants.DEFAULT_RETRIES;
@ -43,14 +41,6 @@ public class ConsumerConfig {
this.async = async;
}
public Boolean getOneway() {
return isOneway;
}
public void setOneway(Boolean oneway) {
isOneway = oneway;
}
public Integer getRetries() {
return retries;
}

1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/client/ConsumerInterceptor.java

@ -86,7 +86,6 @@ public class ConsumerInterceptor {
consumerConfig.setAsync(rpc.async());
consumerConfig.setCallBackClass(rpc.callback());
consumerConfig.setRetries(rpc.retries());
consumerConfig.setOneway(rpc.isOneway());
}
ConsumerConfigCache.putConfig(serviceName, consumerConfig);

2
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/rpc/common/ConsumerConfigConstants.java

@ -8,7 +8,5 @@ public class ConsumerConfigConstants {
public static final Boolean DEFAULT_SYNC = false;
public static final Boolean DEFAULT_IS_ONEWAY = false;
public static final Integer DEFAULT_RETRIES = 3;
}

Loading…
Cancel
Save