use of com.akaxin.common.command.Command in project openzaly by akaxincom.
the class GroupNotice method groupMsgNotice.
/**
* 往群组中发送通知消息<eg:王小王加入了群聊天>
*
* @param groupId
* 发送通知的群
* @param siteUserId
* 备用字段,兼容官方号推送通知消息,发送方ID
*/
private void groupMsgNotice(String siteUserId, String siteGroupId, String noticeText) {
CoreProto.GroupMsgNotice groupMsgNotice = CoreProto.GroupMsgNotice.newBuilder().setMsgId(buildGroupMsgId(siteUserId)).setSiteUserId(siteUserId).setSiteGroupId(siteGroupId).setText(ByteString.copyFromUtf8(noticeText)).setTime(System.currentTimeMillis()).build();
ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder().setType(CoreProto.MsgType.GROUP_NOTICE).setGroupMsgNotice(groupMsgNotice).build();
Command command = new Command();
command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
command.setSiteUserId(siteUserId);
command.setSiteGroupId(siteGroupId);
command.setParams(request.toByteArray());
logger.debug("group msg notice command={}", command.toString());
groupMsgService.execute(command);
}
use of com.akaxin.common.command.Command in project openzaly by akaxincom.
the class NettyClientHandler method channelRead0.
@Override
protected void channelRead0(ChannelHandlerContext ctx, RedisCommand redisCmd) throws Exception {
String version = redisCmd.getParameterByIndex(0);
String action = redisCmd.getParameterByIndex(1);
byte[] params = redisCmd.getBytesParamByIndex(2);
CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params);
CoreProto.ErrorInfo errInfo = packageData.getErr();
Command command = new Command();
command.setHeader(packageData.getHeaderMap());
command.setParams(packageData.getData().toByteArray());
// logger.info("netty client channel handler command={}", command.toString());
NettyClientHandler.this.nettyClient.handleResponse(new RedisCommandResponse(redisCmd, errInfo.getCode(), errInfo.getInfo()));
}
use of com.akaxin.common.command.Command in project openzaly by akaxincom.
the class Bootstrap method startHttpServer.
/**
* 启动Http服务,提供与扩展服务之间的hai(http application interface)接口功能
*
* @throws Exception
*/
private static void startHttpServer(String address, int port) throws Exception {
new HttpServer() {
@Override
public void loadExecutor(AbstracteExecutor<Command, CommandResponse> executor) {
executor.addChain(HttpUriAction.HTTP_ACTION.getUri(), new HttpRequestHandler());
}
}.start(address, port);
logger.info("{} start http server {}:{} ok.", AkxProject.PLN, address, port);
}
Aggregations