org.apache.rocketmq.common.constant.DBMsgConstants Java Examples

The following examples show how to use org.apache.rocketmq.common.constant.DBMsgConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSendMessageProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #2
Source File: AbstractSendMessageProcessor.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #3
Source File: AbstractSendMessageProcessor.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * msg的一些常见检查
 * @param ctx ctx
 * @param requestHeader 请求header
 * @param request request
 * @param response response
 * @return ;
 */
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #4
Source File: AbstractSendMessageProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
                                          final SendMessageRequestHeader requestHeader, RemotingCommand request,
                                          final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #5
Source File: AbstractSendMessageProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #6
Source File: AbstractSendMessageProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #7
Source File: AbstractSendMessageProcessor.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}
 
Example #8
Source File: AbstractSendMessageProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
protected RemotingCommand msgContentCheck(final ChannelHandlerContext ctx,
    final SendMessageRequestHeader requestHeader, RemotingCommand request,
    final RemotingCommand response) {
    if (requestHeader.getTopic().length() > Byte.MAX_VALUE) {
        log.warn("putMessage message topic length too long {}", requestHeader.getTopic().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (requestHeader.getProperties() != null && requestHeader.getProperties().length() > Short.MAX_VALUE) {
        log.warn("putMessage message properties length too long {}", requestHeader.getProperties().length());
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    if (request.getBody().length > DBMsgConstants.MAX_BODY_SIZE) {
        log.warn(" topic {}  msg body size {}  from {}", requestHeader.getTopic(),
            request.getBody().length, ChannelUtil.getRemoteIp(ctx.channel()));
        response.setRemark("msg body must be less 64KB");
        response.setCode(ResponseCode.MESSAGE_ILLEGAL);
        return response;
    }
    return response;
}