Search in sources :

Example 1 with ClubServiceMsgDispatch

use of com.code.server.login.service.ClubServiceMsgDispatch in project summer by foxsugar.

the class UserServiceMsgConsumer method listen3.

@KafkaListener(id = "clubService", topicPattern = "clubService")
public void listen3(ConsumerRecord<String, String> record) {
    String key = record.key();
    String value = record.value();
    KafkaMsgKey msgKey = JsonUtil.readValue(key, KafkaMsgKey.class);
    JsonNode msgValue = JsonUtil.readTree(value);
    ClubServiceMsgDispatch clubServiceMsgDispatch = SpringUtil.getBean(ClubServiceMsgDispatch.class);
    clubServiceMsgDispatch.dispatchMsg(msgKey, msgValue);
}
Also used : ClubServiceMsgDispatch(com.code.server.login.service.ClubServiceMsgDispatch) KafkaMsgKey(com.code.server.constant.kafka.KafkaMsgKey) JsonNode(com.fasterxml.jackson.databind.JsonNode) KafkaListener(org.springframework.kafka.annotation.KafkaListener)

Aggregations

KafkaMsgKey (com.code.server.constant.kafka.KafkaMsgKey)1 ClubServiceMsgDispatch (com.code.server.login.service.ClubServiceMsgDispatch)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 KafkaListener (org.springframework.kafka.annotation.KafkaListener)1