use of com.code.server.login.service.UserServiceMsgDispatch in project summer by foxsugar.
the class UserServiceMsgConsumer method listen.
@KafkaListener(id = "userService", topicPattern = "userService")
public void listen(ConsumerRecord<String, String> record) {
ThreadPool.getInstance().executor.execute(() -> {
String key = record.key();
String value = record.value();
KafkaMsgKey msgKey = JsonUtil.readValue(key, KafkaMsgKey.class);
JsonNode msgValue = JsonUtil.readTree(value);
UserServiceMsgDispatch userServiceMsgDispatch = SpringUtil.getBean(UserServiceMsgDispatch.class);
userServiceMsgDispatch.dispatchMsg(msgKey, msgValue);
});
}
use of com.code.server.login.service.UserServiceMsgDispatch in project summer by foxsugar.
the class UserServiceConsumer method consumer.
@Override
public void consumer(ConsumerRecord<String, String> record) {
ThreadPool.getInstance().executor.execute(() -> {
String key = record.key();
String value = record.value();
KafkaMsgKey msgKey = JsonUtil.readValue(key, KafkaMsgKey.class);
JsonNode msgValue = JsonUtil.readTree(value);
UserServiceMsgDispatch userServiceMsgDispatch = SpringUtil.getBean(UserServiceMsgDispatch.class);
userServiceMsgDispatch.dispatchMsg(msgKey, msgValue);
});
}
Aggregations