|
|
@ -13,8 +13,11 @@ import com.ms.dal.entity.DsMessageConsumerQueue;
|
|
|
|
import com.ms.dal.mapper.DsMessageMapper;
|
|
|
|
import com.ms.dal.mapper.DsMessageMapper;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
|
|
import org.springframework.lang.Nullable;
|
|
|
|
import org.springframework.lang.Nullable;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.TransactionDefinition;
|
|
|
|
|
|
|
|
import org.springframework.transaction.TransactionStatus;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@ -25,6 +28,9 @@ import java.util.Objects;
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
@AllArgsConstructor
|
|
|
|
@AllArgsConstructor
|
|
|
|
public class DsMessageServiceImpl implements DsMessageService{
|
|
|
|
public class DsMessageServiceImpl implements DsMessageService{
|
|
|
|
|
|
|
|
private final DataSourceTransactionManager dataSourceTransactionManager;
|
|
|
|
|
|
|
|
private final TransactionDefinition transactionDefinition;
|
|
|
|
|
|
|
|
|
|
|
|
private DsMessageMapper dsMessageMapper;
|
|
|
|
private DsMessageMapper dsMessageMapper;
|
|
|
|
private DsMessageConsumerBufferService dsMessageConsumerBufferService;
|
|
|
|
private DsMessageConsumerBufferService dsMessageConsumerBufferService;
|
|
|
|
private DsMessageConsumerQueueService dsMessageConsumerQueueService;
|
|
|
|
private DsMessageConsumerQueueService dsMessageConsumerQueueService;
|
|
|
@ -113,10 +119,17 @@ public class DsMessageServiceImpl implements DsMessageService{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
|
|
|
|
public void addDsMessage(Long shopId, Long platformPushMsgId, String bizId, String bizType, String data) {
|
|
|
|
public void addDsMessage(Long shopId, Long platformPushMsgId, String bizId, String bizType, String data) {
|
|
|
|
DsMessage dsMessage = add(shopId, platformPushMsgId, bizId, bizType, data);
|
|
|
|
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
|
|
|
dsMessageConsumerBufferService.addBuffer(shopId, dsMessage.getDsMessageId(), null);
|
|
|
|
try {
|
|
|
|
|
|
|
|
log.error("addDsMessagePlatformPushMsgId" + platformPushMsgId);
|
|
|
|
|
|
|
|
DsMessage dsMessage = add(shopId, platformPushMsgId, bizId, bizType, data);
|
|
|
|
|
|
|
|
dsMessageConsumerBufferService.addBuffer(shopId, dsMessage.getDsMessageId(), null);
|
|
|
|
|
|
|
|
dataSourceTransactionManager.commit(transactionStatus);
|
|
|
|
|
|
|
|
} catch (Throwable e) {
|
|
|
|
|
|
|
|
log.error("addDsMessageError", e);
|
|
|
|
|
|
|
|
dataSourceTransactionManager.rollback(transactionStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|