10 changed files with 140 additions and 0 deletions
@ -0,0 +1,48 @@ |
|||||
|
package com.elink.esua.epdc.modules.rocketmq.consumer; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant; |
||||
|
import com.elink.esua.epdc.modules.reportissue.service.ReportIssueService; |
||||
|
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.rocketmq.common.message.MessageExt; |
||||
|
import org.apache.rocketmq.spring.annotation.MessageModel; |
||||
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
||||
|
import org.apache.rocketmq.spring.core.RocketMQListener; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* 内容审核驳回信息处理-监听MQ消息 |
||||
|
* |
||||
|
* @Author:wangtong |
||||
|
* @Date:2020/7/14 1:54 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RocketMQMessageListener(topic = RocketMqConstant.MQ_TOPIC_REPORT_ISSUE, consumerGroup = "${rocketmq.consumer.contentSecurity-group}", messageModel = MessageModel.BROADCASTING) |
||||
|
public class RejectCheckRecordConsumer implements RocketMQListener<MessageExt> { |
||||
|
|
||||
|
@Autowired |
||||
|
private ReportIssueService reportIssueService; |
||||
|
@Override |
||||
|
public void onMessage(MessageExt messageExt) { |
||||
|
log.info("EPDC-CUSTOM-SERVER消费消息START:{topic:{}, msgId:{}}", RocketMqConstant.MQ_TOPIC_REPORT_ISSUE, messageExt.getMsgId()); |
||||
|
try { |
||||
|
String charset = "UTF-8"; |
||||
|
String body = new String(messageExt.getBody(), charset); |
||||
|
String tag = messageExt.getTags(); |
||||
|
RejectRecordDTO dto = JSONObject.parseObject(body, RejectRecordDTO.class); |
||||
|
if(RocketMqConstant.MQ_TAG_REPORT_ISSUE_CONTENTSECURITY.equals(tag)){ |
||||
|
//删除发布活动相关信息
|
||||
|
reportIssueService.rejectActInfo(dto); |
||||
|
} |
||||
|
|
||||
|
log.info("EPDC-CUSTOM-SERVER消费消息END:{topic:{}, msgId:{}, body:{}}", RocketMqConstant.MQ_TOPIC_REPORT_ISSUE, messageExt.getMsgId(), body); |
||||
|
} catch (Exception e) { |
||||
|
log.info("EPDC-CUSTOM-SERVER消费消息失败:msgId:{}", messageExt.getMsgId()); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.elink.esua.epdc.modules.rocketmq.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* 内容审核驳回信息处理-发送MQ消息DTO |
||||
|
* |
||||
|
* @Author: wangtong |
||||
|
* @Date: 2020/7/14 14:58 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class RejectRecordDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 3032661994413974324L; |
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 关联信息ID |
||||
|
*/ |
||||
|
private String relationId; |
||||
|
} |
Loading…
Reference in new issue