| | |
| | | |
| | | import cc.mrbird.febs.rabbit.QueueEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.AmqpException; |
| | | import org.springframework.amqp.core.Message; |
| | | import org.springframework.amqp.core.MessagePostProcessor; |
| | | import org.springframework.amqp.rabbit.connection.CorrelationData; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public void sendDitribProfit(Long id) { |
| | | log.info("发送滑点分配消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.DISTRIB_PROFIT.getExchange(), QueueEnum.DISTRIB_PROFIT.getRoute(), id, correlationData); |
| | | rabbitTemplate.convertAndSend(QueueEnum.GFA_ZY_HUA_DIAN.getExchange(), QueueEnum.GFA_ZY_HUA_DIAN.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | public void sendUserBuyReward(Long id) { |
| | | log.info("发送用户购买奖励消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.USER_BUY_REWARD.getExchange(), QueueEnum.USER_BUY_REWARD.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | |
| | | public void sendZhiYaDelayMsg(Long id, Long times) { |
| | | log.info("发送延时质押消息:{}, {}", id, times); |
| | | rabbitTemplate.convertAndSend(QueueEnum.GFA_ZY_TIME_TTL.getExchange(), |
| | | QueueEnum.GFA_ZY_TIME_TTL.getRoute(), |
| | | id, new MessagePostProcessor() { |
| | | @Override |
| | | public Message postProcessMessage(Message message) throws AmqpException { |
| | | message.getMessageProperties().setExpiration(String.valueOf(times)); |
| | | return message; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | public void sendZhiYaDelayFlowMsg(Long id, Long times) { |
| | | log.info("发送延时质押流水消息:{}, {}", id, times); |
| | | rabbitTemplate.convertAndSend(QueueEnum.GFA_ZY_TIME_TTL_FLOW.getExchange(), |
| | | QueueEnum.GFA_ZY_TIME_TTL_FLOW.getRoute(), |
| | | id, new MessagePostProcessor() { |
| | | @Override |
| | | public Message postProcessMessage(Message message) throws AmqpException { |
| | | message.getMessageProperties().setExpiration(String.valueOf(times)); |
| | | return message; |
| | | } |
| | | }); |
| | | } |
| | | } |