use of com.alibaba.rocketmq.client.impl.consumer.DefaultMQPullConsumerImpl in project LinkAgent by shulieTech.
the class PullConsumerInterceptor method doAfter.
@Override
public void doAfter(Advice advice) {
Object[] args = advice.getParameterArray();
Object result = advice.getReturnObj();
if (!checkArgs(args, result)) {
return;
}
DefaultMQPullConsumerImpl consumer = (DefaultMQPullConsumerImpl) advice.getTarget();
MessageQueue mq = (MessageQueue) args[0];
PullResult pullResult = (PullResult) result;
ConsumeMessageContext consumeMessageContext = new ConsumeMessageContext();
consumeMessageContext.setConsumerGroup(consumer.groupName());
consumeMessageContext.setMq(mq);
consumeMessageContext.setMsgList(pullResult.getMsgFoundList());
consumeMessageContext.setSuccess(false);
hook.consumeMessageBefore(consumeMessageContext);
consumeMessageContext.setStatus(ConsumeConcurrentlyStatus.CONSUME_SUCCESS.toString());
consumeMessageContext.setSuccess(true);
hook.consumeMessageAfter(consumeMessageContext);
}
Aggregations