use of com.jim.framework.rpc.common.RpcRequest in project jim-framework by jiangmin168168.
the class AbstractHeartbeatHandler method sendPing.
protected void sendPing(ChannelHandlerContext channelHandlerContext) {
RpcMessage message = new RpcMessage();
RpcRequest rpcRequest = new RpcRequest();
rpcRequest.setRequestId("ping");
RpcMessageHeader messageHeader = new RpcMessageHeader();
messageHeader.setLength(1);
messageHeader.setType(Constants.MESSAGE_TYPE_HEARTBEAT_PING);
message.setMessageHeader(messageHeader);
message.setMessageBody(rpcRequest);
channelHandlerContext.writeAndFlush(message);
logger.info("ping:{}", message.getMessageBody());
}
use of com.jim.framework.rpc.common.RpcRequest in project jim-framework by jiangmin168168.
the class RpcHystrixCommand method run.
@Override
protected Object run() {
RpcRequest request = new RpcRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setClassName(method.getDeclaringClass().getName());
request.setMethodName(method.getName());
request.setParameterTypes(method.getParameterTypes());
request.setParameters(this.params);
if (this.rpcReference != null) {
request.setMaxExecutesCount(this.rpcReference.maxExecutesCount());
}
request.setContextParameters(RpcContext.getContext().getContextParameters());
RpcClientInvoker invoker = RpcClientInvokerManager.getInstance(this.referenceConfig).getInvoker();
invoker.setRpcRequest(request);
RpcInvoker rpcInvoker = invoker.buildInvokerChain(invoker);
ResponseFuture response = (ResponseFuture) rpcInvoker.invoke(invoker.buildRpcInvocation(request));
if (this.rpcReference.isSync()) {
return response.get();
} else {
RpcContext.getContext().setResponseFuture(response);
return null;
}
}
Aggregations