Search in sources :

Example 6 with TpcMqMessage

use of com.paascloud.provider.model.domain.TpcMqMessage in project paascloud-master by paascloud.

the class TpcMqMessageServiceImpl method confirmAndSendMessage.

@Override
public void confirmAndSendMessage(String messageKey) {
    final TpcMqMessage message = tpcMqMessageMapper.getByMessageKey(messageKey);
    if (message == null) {
        throw new TpcBizException(ErrorCodeEnum.TPC10050002);
    }
    TpcMqMessage update = new TpcMqMessage();
    update.setMessageStatus(MqSendStatusEnum.SENDING.sendStatus());
    update.setId(message.getId());
    update.setUpdateTime(new Date());
    tpcMqMessageMapper.updateByPrimaryKeySelective(update);
    // 创建消费待确认列表
    this.createMqConfirmListByTopic(message.getMessageTopic(), message.getId(), message.getMessageKey());
    // 直接发送消息
    this.directSendMessage(message.getMessageBody(), message.getMessageTopic(), message.getMessageTag(), message.getMessageKey(), message.getProducerGroup(), message.getDelayLevel());
}
Also used : TpcMqMessage(com.paascloud.provider.model.domain.TpcMqMessage) TpcBizException(com.paascloud.provider.exceptions.TpcBizException) Date(java.util.Date)

Example 7 with TpcMqMessage

use of com.paascloud.provider.model.domain.TpcMqMessage in project paascloud-master by paascloud.

the class TpcMqMessageServiceImpl method resendMessageByMessageId.

@Override
public void resendMessageByMessageId(Long messageId) {
    final TpcMqMessage message = tpcMqMessageMapper.selectByPrimaryKey(messageId);
    if (message == null) {
        throw new TpcBizException(ErrorCodeEnum.TPC10050006);
    }
    this.resendMessage(message);
}
Also used : TpcMqMessage(com.paascloud.provider.model.domain.TpcMqMessage) TpcBizException(com.paascloud.provider.exceptions.TpcBizException)

Aggregations

TpcMqMessage (com.paascloud.provider.model.domain.TpcMqMessage)7 TpcBizException (com.paascloud.provider.exceptions.TpcBizException)5 Date (java.util.Date)4 ModelMapper (org.modelmapper.ModelMapper)2 Transactional (org.springframework.transaction.annotation.Transactional)1