Github user vongosling commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/53#discussion_r101990343
  
    --- Diff: 
broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
 ---
    @@ -442,6 +449,202 @@ private RemotingCommand sendMessage(final 
ChannelHandlerContext ctx, //
             return response;
         }
     
    +    private RemotingCommand sendBatchMessage(final ChannelHandlerContext 
ctx, //
    +                                        final RemotingCommand request, //
    +                                        final SendMessageContext 
sendMessageContext, //
    +                                        final SendMessageRequestHeader 
requestHeader) throws RemotingCommandException {
    +
    +        final RemotingCommand response = 
RemotingCommand.createResponseCommand(SendMessageResponseHeader.class);
    +        final SendMessageResponseHeader responseHeader = 
(SendMessageResponseHeader) response.readCustomHeader();
    +
    +
    +        response.setOpaque(request.getOpaque());
    +
    +        response.addExtField(MessageConst.PROPERTY_MSG_REGION, 
this.brokerController.getBrokerConfig().getRegionId());
    +        response.addExtField(MessageConst.PROPERTY_TRACE_SWITCH, 
String.valueOf(this.brokerController.getBrokerConfig().isTraceOn()));
    +
    +        if (log.isDebugEnabled()) {
    +            log.debug("receive SendMessage request command, " + request);
    +        }
    +
    +        final long startTimstamp = 
this.brokerController.getBrokerConfig().getStartAcceptSendRequestTimeStamp();
    +        if (this.brokerController.getMessageStore().now() < startTimstamp) 
{
    +            response.setCode(ResponseCode.SYSTEM_ERROR);
    +            response.setRemark(String.format("broker unable to service, 
until %s", UtilAll.timeMillisToHumanString2(startTimstamp)));
    +            return response;
    +        }
    +
    +        response.setCode(-1);
    +        super.msgCheck(ctx, requestHeader, response);
    +        if (response.getCode() != -1) {
    +            return response;
    +        }
    +
    +
    +        int queueIdInt = requestHeader.getQueueId();
    +        TopicConfig topicConfig = 
this.brokerController.getTopicConfigManager().selectTopicConfig(requestHeader.getTopic());
    +
    +        if (queueIdInt < 0) {
    +            queueIdInt = Math.abs(this.random.nextInt() % 99999999) % 
topicConfig.getWriteQueueNums();
    +        }
    +
    +        int sysFlag = requestHeader.getSysFlag();
    +        if (TopicFilterType.MULTI_TAG == topicConfig.getTopicFilterType()) 
{
    +            sysFlag |= MessageSysFlag.MULTI_TAGS_FLAG;
    +        }
    +
    +        String newTopic = requestHeader.getTopic();
    +        if (null != newTopic && 
newTopic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
    +            String groupName = 
newTopic.substring(MixAll.RETRY_GROUP_TOPIC_PREFIX.length());
    +            SubscriptionGroupConfig subscriptionGroupConfig =
    +                    
this.brokerController.getSubscriptionGroupManager().findSubscriptionGroupConfig(groupName);
    +            if (null == subscriptionGroupConfig) {
    +                
response.setCode(ResponseCode.SUBSCRIPTION_GROUP_NOT_EXIST);
    +                response.setRemark(
    +                        "subscription group not exist, " + groupName + " " 
+ FAQUrl.suggestTodo(FAQUrl.SUBSCRIPTION_GROUP_NOT_EXIST));
    +                return response;
    +            }
    +
    +
    +            int maxReconsumeTimes = 
subscriptionGroupConfig.getRetryMaxTimes();
    +            if (request.getVersion() >= 
MQVersion.Version.V3_4_9.ordinal()) {
    +                maxReconsumeTimes = requestHeader.getMaxReconsumeTimes();
    +            }
    +            int reconsumeTimes = requestHeader.getReconsumeTimes() == null 
? 0 : requestHeader.getReconsumeTimes();
    +            if (reconsumeTimes >= maxReconsumeTimes) {
    +                newTopic = MixAll.getDLQTopic(groupName);
    +                queueIdInt = Math.abs(this.random.nextInt() % 99999999) % 
DLQ_NUMS_PER_GROUP;
    +                topicConfig = 
this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic,
 //
    +                        DLQ_NUMS_PER_GROUP, //
    +                        PermName.PERM_WRITE, 0
    +                );
    +                if (null == topicConfig) {
    +                    response.setCode(ResponseCode.SYSTEM_ERROR);
    +                    response.setRemark("topic[" + newTopic + "] not 
exist");
    +                    return response;
    +                }
    +            }
    +        }
    +        if (newTopic.length() > Byte.MAX_VALUE) {
    +            response.setCode(ResponseCode.MESSAGE_ILLEGAL);
    +            response.setRemark("message topic length too long " + 
newTopic.length());
    +            return response;
    +        }
    +
    +
    +        MessageExtBatch messageExtBatch = new MessageExtBatch();
    +        messageExtBatch.setTopic(newTopic);
    --- End diff --
    
    Drawback 1 : only support the same topic


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to