use of com.paascloud.provider.model.enums.MqSendTypeEnum in project paascloud-master by paascloud.
the class MqProducerStoreAspect method processMqProducerStoreJoinPoint.
/**
* Add exe time method object.
*
* @param joinPoint the join point
*
* @return the object
*/
@Around(value = "mqProducerStoreAnnotationPointcut()")
public Object processMqProducerStoreJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable {
log.info("processMqProducerStoreJoinPoint - 线程id={}", Thread.currentThread().getId());
Object result;
Object[] args = joinPoint.getArgs();
MqProducerStore annotation = getAnnotation(joinPoint);
MqSendTypeEnum type = annotation.sendType();
int orderType = annotation.orderType().orderType();
DelayLevelEnum delayLevelEnum = annotation.delayLevel();
if (args.length == 0) {
throw new TpcBizException(ErrorCodeEnum.TPC10050005);
}
MqMessageData domain = null;
for (Object object : args) {
if (object instanceof MqMessageData) {
domain = (MqMessageData) object;
break;
}
}
if (domain == null) {
throw new TpcBizException(ErrorCodeEnum.TPC10050005);
}
domain.setOrderType(orderType);
domain.setProducerGroup(producerGroup);
if (type == MqSendTypeEnum.WAIT_CONFIRM) {
if (delayLevelEnum != DelayLevelEnum.ZERO) {
domain.setDelayLevel(delayLevelEnum.delayLevel());
}
mqMessageService.saveWaitConfirmMessage(domain);
}
result = joinPoint.proceed();
if (type == MqSendTypeEnum.SAVE_AND_SEND) {
mqMessageService.saveAndSendMessage(domain);
} else if (type == MqSendTypeEnum.DIRECT_SEND) {
mqMessageService.directSendMessage(domain);
} else {
mqMessageService.confirmAndSendMessage(domain.getMessageKey());
}
return result;
}
Aggregations