| | |
| | | import com.yeshi.makemoney.app.dto.mq.AddGoldCornMQMsg; |
| | | import com.yeshi.makemoney.app.dto.mq.ExtractTransferResultMQMsg; |
| | | import com.yeshi.makemoney.app.dto.mq.GoldCornSettleMQMsg; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.mq.TDMQUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @date 2022/4/1 17:06 |
| | | */ |
| | | public class CMQManager { |
| | | Logger logger= LoggerFactory.getLogger(CMQManager.class); |
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | private static CMQManager cmqManager; |
| | |
| | | |
| | | public void addAddGoldCornMsg(AddGoldCornMQMsg msg) { |
| | | String content = new Gson().toJson(msg); |
| | | |
| | | tdmqUtil.sendMsg(QUEUE_ADD_GOLDCORN, content); |
| | | } |
| | | |
| | |
| | | **/ |
| | | public void addGoldCornSettleMsg(GoldCornSettleMQMsg msg) { |
| | | String content = new Gson().toJson(msg); |
| | | tdmqUtil.sendMsg(QUEUE_GOLDCORN_SETTLE, content); |
| | | logger.debug("添加结算消息开始:",content); |
| | | TDMQUtil.getInstance().sendMsg(QUEUE_GOLDCORN_SETTLE, content); |
| | | //添加日志 |
| | | logger.debug("添加结算消息结束:{}",content); |
| | | } |
| | | /** |
| | | * 批量添加 |
| | | **/ |
| | | public void addGoldCornSettleMsg(List<GoldCornSettleMQMsg> msgList) throws Exception { |
| | | List<String> contentList=new ArrayList<>(); |
| | | for(GoldCornSettleMQMsg msg:msgList) { |
| | | contentList.add(new Gson().toJson(msg)); |
| | | } |
| | | logger.debug("添加结算消息开始:{}",msgList.size()); |
| | | TDMQUtil.getInstance().batchSendMsg(QUEUE_GOLDCORN_SETTLE, contentList); |
| | | //添加日志 |
| | | logger.debug("添加结算消息结束:{}",msgList.size()); |
| | | } |
| | | |
| | | public Map<String, GoldCornSettleMQMsg> consumeGoldCornSettleMsg(int count) { |
| | | List<Message> list = tdmqUtil.recieveMsg(count, QUEUE_GOLDCORN_SETTLE); |
| | | List<Message> list = TDMQUtil.getInstance().recieveMsg(count, QUEUE_GOLDCORN_SETTLE); |
| | | Map<String, GoldCornSettleMQMsg> map = new HashMap<>(); |
| | | if (list != null) { |
| | | for (Message msg : list) { |
| | |
| | | } |
| | | |
| | | public void deleteGoldCornSettleMsg(String receiptHandle) { |
| | | tdmqUtil.deleteMsg(QUEUE_GOLDCORN_SETTLE, receiptHandle); |
| | | TDMQUtil.getInstance().deleteMsg(QUEUE_GOLDCORN_SETTLE, receiptHandle); |
| | | } |
| | | |
| | | |