Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
a19ef644
Commit
a19ef644
authored
Apr 09, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Netty客户端测试用例
parent
52b5f3fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
0 deletions
+147
-0
TaskClient.java
...n/src/main/java/com/byit/task/annotations/TaskClient.java
+32
-0
TaskServer.java
...in-rpc-client/src/main/java/com/byit/call/TaskServer.java
+17
-0
pom.xml
demo-client/byit-plugin-client/pom.xml
+28
-0
TestController.java
...ent/src/main/java/com/byit/controller/TestController.java
+41
-0
TestService.java
...in-client/src/main/java/com/byit/service/TestService.java
+11
-0
TestServiceImpl.java
...lient/src/main/java/com/byit/service/TestServiceImpl.java
+18
-0
No files found.
byit-plugin-core/byit-plugin-rpc-common/src/main/java/com/byit/task/annotations/TaskClient.java
0 → 100644
View file @
a19ef644
package
com
.
byit
.
task
.
annotations
;
import
com.byit.rpc.remoting.invoker.route.LoadBalance
;
import
java.lang.annotation.*
;
/**
* 任务的客户端 标识在属性层 表示为他是能够调用服务的一个属性 又系统进行自动注入
* @author huangfu
*/
@Documented
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
TaskClient
{
/**
* 负载均衡策略
* @return
*/
LoadBalance
loadBalance
()
default
LoadBalance
.
ROUND
;
/**
* htpp方式的回调通知地址
* @return
*/
String
callbackUrl
()
default
""
;
/**
* 超时时间
* @return
*/
long
timeout
()
default
1000
;
}
byit-plugin-core/myth-plugin-rpc-client/src/main/java/com/byit/call/TaskServer.java
0 → 100644
View file @
a19ef644
package
com
.
byit
.
call
;
import
com.byit.packet.request.PluginRpcRequestPacket
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
/**
* 远程调用task服务类
* @author huangfu
*/
public
interface
TaskServer
{
/**
* 插件通讯接口
* @param rpcRequestPacket 数据
* @return 结果集
*/
PluginRpcResponsePacket
call
(
PluginRpcRequestPacket
rpcRequestPacket
);
}
demo-client/byit-plugin-client/pom.xml
0 → 100644
View file @
a19ef644
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
demo-client
</artifactId>
<groupId>
myth-job
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
byit-plugin-client
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
myth-job
</groupId>
<artifactId>
myth-plugin-rpc-client
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
demo-client/byit-plugin-client/src/main/java/com/byit/controller/TestController.java
0 → 100644
View file @
a19ef644
package
com
.
byit
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.packet.request.PluginRpcRequestPacket
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
import
com.byit.param.defaultparam.DefaultResultCallback
;
import
com.byit.service.TestService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
TestController
{
@Autowired
private
TestService
testService
;
@RequestMapping
(
"test"
)
public
PluginRpcResponsePacket
test
(){
PluginRpcRequestPacket
pluginRpcRequestPacket
=
new
PluginRpcRequestPacket
();
pluginRpcRequestPacket
.
setJobName
(
"01Test"
);
pluginRpcRequestPacket
.
setParam
(
"123"
);
pluginRpcRequestPacket
.
setExtension
(
"13213213"
);
pluginRpcRequestPacket
.
setResultCallback
(
new
DefaultResultCallback
());
return
testService
.
test
(
pluginRpcRequestPacket
);
}
public
static
void
main
(
String
[]
args
)
{
PluginRpcRequestPacket
pluginRpcRequestPacket
=
new
PluginRpcRequestPacket
();
pluginRpcRequestPacket
.
setJobName
(
"01Test"
);
pluginRpcRequestPacket
.
setParam
(
"123"
);
pluginRpcRequestPacket
.
setExtension
(
"13213213"
);
pluginRpcRequestPacket
.
setResultCallback
(
new
DefaultResultCallback
());
String
x
=
JSON
.
toJSONString
(
pluginRpcRequestPacket
);
System
.
out
.
println
(
x
);
PluginRpcRequestPacket
pluginRpcRequestPacket1
=
JSON
.
parseObject
(
x
,
PluginRpcRequestPacket
.
class
);
PluginRpcResponsePacket
pluginRpcResponsePacket
=
new
PluginRpcResponsePacket
();
pluginRpcResponsePacket
.
setCode
(
"0000000"
);
pluginRpcRequestPacket
.
getResultCallback
().
resultCallback
(
null
,
pluginRpcResponsePacket
);
}
}
demo-client/byit-plugin-client/src/main/java/com/byit/service/TestService.java
0 → 100644
View file @
a19ef644
package
com
.
byit
.
service
;
import
com.byit.packet.request.PluginRpcRequestPacket
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
/**
* @author Administrator
*/
public
interface
TestService
{
PluginRpcResponsePacket
test
(
PluginRpcRequestPacket
pluginRpcRequestPacket
);
}
demo-client/byit-plugin-client/src/main/java/com/byit/service/TestServiceImpl.java
0 → 100644
View file @
a19ef644
package
com
.
byit
.
service
;
import
com.byit.call.TaskServer
;
import
com.byit.packet.request.PluginRpcRequestPacket
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
import
com.byit.task.annotations.TaskClient
;
import
org.springframework.stereotype.Service
;
@Service
public
class
TestServiceImpl
implements
TestService
{
@TaskClient
TaskServer
taskServer
;
@Override
public
PluginRpcResponsePacket
test
(
PluginRpcRequestPacket
pluginRpcRequestPacket
)
{
return
taskServer
.
call
(
pluginRpcRequestPacket
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment