Commit 5b636225 by huangfusuper

调整代码规范

parent f9d7178d
package com.byit.conf;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.byit.dto.web.ResponseResult;
import com.byit.packet.response.PluginRpcResponsePacket;
import com.byit.param.ResultCallback;
import io.netty.channel.ChannelHandlerContext;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
/**
* @author huangfu
*/
public class RpcResultHttpCallback implements ResultCallback {
private String gatewayIpAndPort;
public RpcResultHttpCallback(String gatewayIpAndPort) {
this.gatewayIpAndPort = "http://"+gatewayIpAndPort+"/myth-job-admin/api/callback/callbackRes";
}
@Override
public void resultCallback(ChannelHandlerContext ctx, PluginRpcResponsePacket pluginRpcResponsePacket) {
Object result = pluginRpcResponsePacket.getResult();
String responseStr = JSON.toJSONString(pluginRpcResponsePacket, WriteClassName);
HttpRequest post = HttpRequest.post(gatewayIpAndPort);
post.header("token", "Token");
post.body("param="+responseStr).execute();
System.out.println("-------消息回复成功-----------");
}
}
......@@ -8,6 +8,7 @@ import org.springframework.context.ApplicationEvent;
*/
public class EndFlowEvent extends ApplicationEvent {
private static final long serialVersionUID = 2874836396737756384L;
private Integer flowId;
/**
......
......@@ -16,6 +16,7 @@ import java.io.Serializable;
@NoArgsConstructor
public class JobStatusResultDto implements Serializable {
private static final long serialVersionUID = -3939600613125618193L;
private String jobName;
/**
* 调度类型
......
......@@ -8,9 +8,9 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Description 运行日志信息
* @Author guo_m
* @Date 2020-03-19
* 运行日志信息
* author guo_m
* @date 2020-03-19
*/
@Data
@Builder
......
......@@ -9,6 +9,7 @@ import java.io.Serializable;
/**
* 当前规定的所有的返回结果集都必须是{@link com.byit.dto.specials.SpecialJavaNode} 类型的
* 这个方法是rpc回调结果集合
*
* @program: byit-myth-job->ReturnResult
* @description: 服务调用的返回结果
......
......@@ -42,6 +42,9 @@ public class ImperativeExecutionImpl implements ScriptExecutorService {
private final ParameterVerificationProcessingMachine parameterVerificationProcessingMachine;
private final StringRedisTemplate stringRedisTemplate;
/**
* 节点运行成功代码
*/
private static final Integer NODE_RUN_SUCCESS_CODE = 0;
/**
* 节点被杀死
......
......@@ -4,7 +4,6 @@ import com.byit.enums.Command;
import com.byit.enums.SerializerAlgorithm;
import com.byit.packet.BasePacketModel;
import com.byit.param.CommunicationParam;
import com.byit.param.ResultCallback;
import lombok.Data;
import lombok.EqualsAndHashCode;
......
package com.byit.param;
import com.byit.packet.response.PluginRpcResponsePacket;
import io.netty.channel.ChannelHandlerContext;
import java.io.Serializable;
/**
* @author 结果集回调 用户自定义实现 执行完成后的结果返回操作
*/
public interface ResultCallback extends Serializable {
/**
* 对于服务器处理完的数据 用户自定义定义返回操作
* @param ctx
* @param pluginRpcResponsePacket
*/
void resultCallback(ChannelHandlerContext ctx, PluginRpcResponsePacket pluginRpcResponsePacket);
}
......@@ -20,7 +20,7 @@ import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
public class DefaultRemainingOperationsCallBack implements RemainingOperationsCallBack {
@Override
public void serverRemainingOperations(Map<String, Object> map) {
//注册方法数据
//注册方法数据 TODO 这里是游离线程 会出问题
new Thread(() ->{
map.forEach((key,value) ->{
Class<?> nodeClass = value.getClass();
......
......@@ -14,12 +14,17 @@ public class GetRegisteredDataUtil {
/**
* 插件客户端工厂
*/
private PluginSpringClientFactory pluginSpringClientFactory;
private final PluginSpringClientFactory pluginSpringClientFactory;
public GetRegisteredDataUtil(PluginSpringClientFactory pluginSpringClientFactory) {
this.pluginSpringClientFactory = pluginSpringClientFactory;
}
/**
* 根据 服务名称获取该服务下所由的ip地址及端口号
* @param serverName 服务名称
* @return 服务ip:port
*/
public TreeSet<String> getRegisteredIpAndPort(String serverName){
//获取插件工厂对象
PluginClientFactory pluginClientFactory = pluginSpringClientFactory.getPluginClientFactory();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment