-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yefei
committed
May 25, 2020
1 parent
0c3ed53
commit 3be6488
Showing
39 changed files
with
319 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 8 additions & 16 deletions
24
example/src/main/java/com/leaf/example/demo/basic/ConsumerExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,31 @@ | ||
package com.leaf.example.demo.basic; | ||
|
||
import com.leaf.common.UnresolvedAddress; | ||
import com.leaf.common.model.ServiceMeta; | ||
import com.leaf.example.demo.HelloService; | ||
import com.leaf.rpc.DefaultProxyFactory; | ||
import com.leaf.rpc.consumer.LeafClient; | ||
import com.leaf.rpc.consumer.DefaultLeafClient; | ||
import com.leaf.rpc.consumer.LeafClient; | ||
|
||
public class ConsumerExample { | ||
|
||
private static HelloService helloService; | ||
|
||
static { | ||
public static void main(String[] args) { | ||
LeafClient leafClient = new DefaultLeafClient("consumer"); | ||
UnresolvedAddress address = new UnresolvedAddress("127.0.0.1", 9180); | ||
leafClient.connect(address); | ||
leafClient.connect(address); | ||
leafClient.connect(address); | ||
leafClient.connect(address); | ||
|
||
ServiceMeta serviceMeta = new ServiceMeta("test", "org.rpc.example.demo.HelloService", "1.0.0"); | ||
leafClient.client().addChannelGroup(serviceMeta, address); | ||
|
||
helloService = DefaultProxyFactory.factory(HelloService.class) | ||
.consumer(leafClient) | ||
.directory(serviceMeta) | ||
.timeMillis(300000L) | ||
.providers(new UnresolvedAddress("127.0.0.1", 9180)) | ||
.group("test") | ||
.version("1.0.0") | ||
.timeMillis(3000L) | ||
.newProxy(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
new ConsumerExample().invoke(); | ||
} | ||
|
||
public void invoke() { | ||
helloService.sayHello(" biu biu biu!!!"); | ||
String s = helloService.sayHello(" biu biu biu!!!"); | ||
System.out.println(s); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
example/src/main/java/com/leaf/example/demo/generic/HelloService.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.