9 changed files with 100 additions and 43 deletions
@ -1,39 +1,39 @@ |
|||
package com.epmet.mq.listener; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; |
|||
import com.epmet.commons.rocketmq.constants.TopicConstants; |
|||
import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; |
|||
import com.epmet.service.GovStaffRoleService; |
|||
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.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 监听初始化客户动作,为客户初始化角色列表 |
|||
*/ |
|||
@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, |
|||
consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP, |
|||
messageModel = MessageModel.CLUSTERING, |
|||
selectorExpression = "*") |
|||
@Component |
|||
public class InitCustomerRolesListener implements RocketMQListener<MessageExt> { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
@Autowired |
|||
private GovStaffRoleService govStaffRoleService; |
|||
|
|||
@Override |
|||
public void onMessage(MessageExt messageExt) { |
|||
String msg = new String(messageExt.getBody()); |
|||
logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg); |
|||
InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); |
|||
govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId()); |
|||
} |
|||
} |
|||
//package com.epmet.mq.listener;
|
|||
//
|
|||
//import com.alibaba.fastjson.JSON;
|
|||
//import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
|
|||
//import com.epmet.commons.rocketmq.constants.TopicConstants;
|
|||
//import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg;
|
|||
//import com.epmet.service.GovStaffRoleService;
|
|||
//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.slf4j.Logger;
|
|||
//import org.slf4j.LoggerFactory;
|
|||
//import org.springframework.beans.factory.annotation.Autowired;
|
|||
//import org.springframework.stereotype.Component;
|
|||
//
|
|||
///**
|
|||
// * 监听初始化客户动作,为客户初始化角色列表
|
|||
// */
|
|||
//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER,
|
|||
// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP,
|
|||
// messageModel = MessageModel.CLUSTERING,
|
|||
// selectorExpression = "*")
|
|||
//@Component
|
|||
//public class InitCustomerRolesListener implements RocketMQListener<MessageExt> {
|
|||
//
|
|||
// private Logger logger = LoggerFactory.getLogger(getClass());
|
|||
//
|
|||
// @Autowired
|
|||
// private GovStaffRoleService govStaffRoleService;
|
|||
//
|
|||
// @Override
|
|||
// public void onMessage(MessageExt messageExt) {
|
|||
// String msg = new String(messageExt.getBody());
|
|||
// logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg);
|
|||
// InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class);
|
|||
// govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId());
|
|||
// }
|
|||
//}
|
|||
|
Loading…
Reference in new issue