com.alibaba.rocketmq.common.protocol.body.ConsumeMessageDirectlyResult Java Examples

The following examples show how to use com.alibaba.rocketmq.common.protocol.body.ConsumeMessageDirectlyResult. 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: ClientRemotingProcessor.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 6 votes vote down vote up
private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final ConsumeMessageDirectlyResultRequestHeader requestHeader =
            (ConsumeMessageDirectlyResultRequestHeader) request
                .decodeCommandCustomHeader(ConsumeMessageDirectlyResultRequestHeader.class);

    final MessageExt msg = MessageDecoder.decode(ByteBuffer.wrap(request.getBody()));

    ConsumeMessageDirectlyResult result =
            this.mqClientFactory.consumeMessageDirectly(msg, requestHeader.getConsumerGroup(), requestHeader.getBrokerName());

    if (null != result) {
        response.setCode(ResponseCode.SUCCESS);
        response.setBody(result.encode());
    }
    else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #2
Source File: ClientRemotingProcessor.java    From RocketMQ-Master-analyze with Apache License 2.0 6 votes vote down vote up
private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx, RemotingCommand request)
        throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final ConsumeMessageDirectlyResultRequestHeader requestHeader =
            (ConsumeMessageDirectlyResultRequestHeader) request
                .decodeCommandCustomHeader(ConsumeMessageDirectlyResultRequestHeader.class);

    final MessageExt msg = MessageDecoder.decode(ByteBuffer.wrap(request.getBody()));

    ConsumeMessageDirectlyResult result = this.mqClientFactory.consumeMessageDirectly(msg,
        requestHeader.getConsumerGroup(), requestHeader.getBrokerName());

    if (null != result) {
        response.setCode(ResponseCode.SUCCESS);
        response.setBody(result.encode());
    }
    else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer",
            requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #3
Source File: QueryMsgByIdSubCommand.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                    defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
            System.out.println(result);
        } else {

            queryById(defaultMQAdminExt, msgId);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example #4
Source File: ClientRemotingProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final ConsumeMessageDirectlyResultRequestHeader requestHeader =
            (ConsumeMessageDirectlyResultRequestHeader) request
                    .decodeCommandCustomHeader(ConsumeMessageDirectlyResultRequestHeader.class);

    final MessageExt msg = MessageDecoder.decode(ByteBuffer.wrap(request.getBody()));

    ConsumeMessageDirectlyResult result =
            this.mqClientFactory.consumeMessageDirectly(msg, requestHeader.getConsumerGroup(), requestHeader.getBrokerName());

    if (null != result) {
        response.setCode(ResponseCode.SUCCESS);
        response.setBody(result.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #5
Source File: QueryMsgByIdSubCommand.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                    defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
            System.out.println(result);
        }
        else {

            queryById(defaultMQAdminExt, msgId);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example #6
Source File: MQClientInstance.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
public ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, //
                                                           final String consumerGroup, //
                                                           final String brokerName) {
    MQConsumerInner mqConsumerInner = this.consumerTable.get(consumerGroup);
    if (null != mqConsumerInner) {
        DefaultMQPushConsumerImpl consumer = (DefaultMQPushConsumerImpl) mqConsumerInner;

        ConsumeMessageDirectlyResult result =
                consumer.getConsumeMessageService().consumeMessageDirectly(msg, brokerName);
        return result;
    }

    return null;
}
 
Example #7
Source File: MQClientInstance.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, //
        final String consumerGroup, //
        final String brokerName) {
    MQConsumerInner mqConsumerInner = this.consumerTable.get(consumerGroup);
    if (null != mqConsumerInner) {
        DefaultMQPushConsumerImpl consumer = (DefaultMQPushConsumerImpl) mqConsumerInner;

        ConsumeMessageDirectlyResult result = consumer.getConsumeMessageService().consumeMessageDirectly(msg, brokerName);
        return result;
    }

    return null;
}
 
Example #8
Source File: QueryMsgByIdSubCommand.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                    defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, msgId);
            System.out.println(result);
        }
        else {

            queryById(defaultMQAdminExt, msgId);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example #9
Source File: MessageController.java    From rocket-console with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/consumeMessageDirectly.do", method = RequestMethod.POST)
@JsonBody
public Object consumeMessageDirectly(@RequestParam String consumerGroup,
                                     @RequestParam String msgId,
                                     /**如果需要指定特定的clientId的话,自己curl传下clientId吧*/
                                     @RequestParam(required = false) String clientId) {
    logger.info("msgId={} consumerGroup={} clientId={}", msgId, consumerGroup, clientId);
    ConsumeMessageDirectlyResult consumeMessageDirectlyResult = messageService.consumeMessageDirectly(msgId, consumerGroup, clientId);
    logger.info("consumeMessageDirectlyResult={}", JsonUtil.obj2String(consumeMessageDirectlyResult));
    return consumeMessageDirectlyResult;
}
 
Example #10
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        final String msgId = commandLine.getOptionValue('i').trim();
        final String topic = commandLine.getOptionValue('t').trim();
        if (commandLine.hasOption('g') && commandLine.hasOption('d')) {
            final String consumerGroup = commandLine.getOptionValue('g').trim();
            final String clientId = commandLine.getOptionValue('d').trim();
            ConsumeMessageDirectlyResult result =
                    defaultMQAdminExt.consumeMessageDirectly(consumerGroup, clientId, topic,msgId);
            System.out.println(result);
        }
        else {

            queryById(defaultMQAdminExt,topic, msgId);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example #11
Source File: MQClientInstance.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, //
                                                           final String consumerGroup, //
                                                           final String brokerName) {
    MQConsumerInner mqConsumerInner = this.consumerTable.get(consumerGroup);
    if (null != mqConsumerInner) {
        DefaultMQPushConsumerImpl consumer = (DefaultMQPushConsumerImpl) mqConsumerInner;

        ConsumeMessageDirectlyResult result = consumer.getConsumeMessageService().consumeMessageDirectly(msg, brokerName);
        return result;
    }

    return null;
}
 
Example #12
Source File: ConsumeMessageOrderlyService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeOrderlyContext context = new ConsumeOrderlyContext(mq);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeOrderlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
            case COMMIT:
                result.setConsumeResult(CMResult.CR_COMMIT);
                break;
            case ROLLBACK:
                result.setConsumeResult(CMResult.CR_ROLLBACK);
                break;
            case SUCCESS:
                result.setConsumeResult(CMResult.CR_SUCCESS);
                break;
            case SUSPEND_CURRENT_QUEUE_A_MOMENT:
                result.setConsumeResult(CMResult.CR_LATER);
                break;
            default:
                break;
            }
        }
        else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    }
    catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s",//
            RemotingHelper.exceptionSimpleDesc(e),//
            ConsumeMessageOrderlyService.this.consumerGroup,//
            msgs,//
            mq), e);
    }

    result.setAutoCommit(context.isAutoCommit());
    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #13
Source File: ConsumeMessageConcurrentlyService.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(false);
    result.setAutoCommit(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeConcurrentlyContext context = new ConsumeConcurrentlyContext(mq);

    this.resetRetryTopic(msgs);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeConcurrentlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
            case CONSUME_SUCCESS:
                result.setConsumeResult(CMResult.CR_SUCCESS);
                break;
            case RECONSUME_LATER:
                result.setConsumeResult(CMResult.CR_LATER);
                break;
            default:
                break;
            }
        }
        else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    }
    catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
            RemotingHelper.exceptionSimpleDesc(e), //
            ConsumeMessageConcurrentlyService.this.consumerGroup, //
            msgs, //
            mq), e);
    }

    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #14
Source File: ConsumeMessageOrderlyService.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeOrderlyContext context = new ConsumeOrderlyContext(mq);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeOrderlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
            case COMMIT:
                result.setConsumeResult(CMResult.CR_COMMIT);
                break;
            case ROLLBACK:
                result.setConsumeResult(CMResult.CR_ROLLBACK);
                break;
            case SUCCESS:
                result.setConsumeResult(CMResult.CR_SUCCESS);
                break;
            case SUSPEND_CURRENT_QUEUE_A_MOMENT:
                result.setConsumeResult(CMResult.CR_LATER);
                break;
            default:
                break;
            }
        }
        else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    }
    catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
            RemotingHelper.exceptionSimpleDesc(e), //
            ConsumeMessageOrderlyService.this.consumerGroup, //
            msgs, //
            mq), e);
    }

    result.setAutoCommit(context.isAutoCommit());
    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #15
Source File: ConsumeMessageConcurrentlyService.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(false);
    result.setAutoCommit(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeConcurrentlyContext context = new ConsumeConcurrentlyContext(mq);

    this.resetRetryTopic(msgs);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeConcurrentlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
                case CONSUME_SUCCESS:
                    result.setConsumeResult(CMResult.CR_SUCCESS);
                    break;
                case RECONSUME_LATER:
                    result.setConsumeResult(CMResult.CR_LATER);
                    break;
                default:
                    break;
            }
        } else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    } catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
                RemotingHelper.exceptionSimpleDesc(e), //
                ConsumeMessageConcurrentlyService.this.consumerGroup, //
                msgs, //
                mq), e);
    }

    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #16
Source File: ConsumeMessageOrderlyService.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeOrderlyContext context = new ConsumeOrderlyContext(mq);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeOrderlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
                case COMMIT:
                    result.setConsumeResult(CMResult.CR_COMMIT);
                    break;
                case ROLLBACK:
                    result.setConsumeResult(CMResult.CR_ROLLBACK);
                    break;
                case SUCCESS:
                    result.setConsumeResult(CMResult.CR_SUCCESS);
                    break;
                case SUSPEND_CURRENT_QUEUE_A_MOMENT:
                    result.setConsumeResult(CMResult.CR_LATER);
                    break;
                default:
                    break;
            }
        } else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    } catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
                RemotingHelper.exceptionSimpleDesc(e), //
                ConsumeMessageOrderlyService.this.consumerGroup, //
                msgs, //
                mq), e);
    }

    result.setAutoCommit(context.isAutoCommit());
    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #17
Source File: MessageServiceImpl.java    From rocket-console with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(String msgId, String consumerGroup) {
    return consumeMessageDirectly(msgId, consumerGroup, null);
}
 
Example #18
Source File: MQAdminExtImpl.java    From rocket-console with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(String consumerGroup, String clientId, String topic, String msgId) throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    return  MQAdminInstance.threadLocalMQAdminExt().consumeMessageDirectly(consumerGroup,clientId,topic,msgId);
}
 
Example #19
Source File: MQAdminExtImpl.java    From rocket-console with Apache License 2.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(String consumerGroup, String clientId,
                                                           String msgId) throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    return MQAdminInstance.threadLocalMQAdminExt().consumeMessageDirectly(consumerGroup, clientId, msgId);
}
 
Example #20
Source File: ConsumeMessageConcurrentlyService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, String brokerName) {
    ConsumeMessageDirectlyResult result = new ConsumeMessageDirectlyResult();
    result.setOrder(false);
    result.setAutoCommit(true);

    List<MessageExt> msgs = new ArrayList<MessageExt>();
    msgs.add(msg);
    MessageQueue mq = new MessageQueue();
    mq.setBrokerName(brokerName);
    mq.setTopic(msg.getTopic());
    mq.setQueueId(msg.getQueueId());

    ConsumeConcurrentlyContext context = new ConsumeConcurrentlyContext(mq);

    this.resetRetryTopic(msgs);

    final long beginTime = System.currentTimeMillis();

    log.info("consumeMessageDirectly receive new messge: {}", msg);

    try {
        ConsumeConcurrentlyStatus status = this.messageListener.consumeMessage(msgs, context);
        if (status != null) {
            switch (status) {
            case CONSUME_SUCCESS:
                result.setConsumeResult(CMResult.CR_SUCCESS);
                break;
            case RECONSUME_LATER:
                result.setConsumeResult(CMResult.CR_LATER);
                break;
            default:
                break;
            }
        }
        else {
            result.setConsumeResult(CMResult.CR_RETURN_NULL);
        }
    }
    catch (Throwable e) {
        result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
        result.setRemark(RemotingHelper.exceptionSimpleDesc(e));

        log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s",//
            RemotingHelper.exceptionSimpleDesc(e),//
            ConsumeMessageConcurrentlyService.this.consumerGroup,//
            msgs,//
            mq), e);
    }

    result.setSpentTimeMills(System.currentTimeMillis() - beginTime);

    log.info("consumeMessageDirectly Result: {}", result);

    return result;
}
 
Example #21
Source File: MessageService.java    From rocket-console with Apache License 2.0 2 votes vote down vote up
/**
 * 自己指定clientId进行发送
 */
ConsumeMessageDirectlyResult consumeMessageDirectly(String msgId, String consumerGroup, String clientId);
 
Example #22
Source File: MessageService.java    From rocket-console with Apache License 2.0 2 votes vote down vote up
/**
 * 系统选取第一个clientId进行发送
 */
ConsumeMessageDirectlyResult consumeMessageDirectly(String msgId, String consumerGroup);
 
Example #23
Source File: ConsumeMessageService.java    From rocketmq with Apache License 2.0 votes vote down vote up
ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, final String brokerName); 
Example #24
Source File: ConsumeMessageService.java    From RocketMQ-Master-analyze with Apache License 2.0 votes vote down vote up
ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, final String brokerName); 
Example #25
Source File: ConsumeMessageService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 votes vote down vote up
ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, final String brokerName);