use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class DouDiZhuGoldRobot method jiaoDizhu.
@Override
public void jiaoDizhu(GameDouDiZhu game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setUserId(game.canJiaoUser);
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
// 按service的名字 分topic
// {"service":"gameService","method":"jiaoDizhu","params":{"isJiao":true,"score":3}}
Map<String, Object> put = new HashMap<>();
put.put("isJiao", false);
ResponseRobotVo result = new ResponseRobotVo("gameService", "jiaoDizhu", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class GameDouDiZhu method genRecord.
protected void genRecord() {
long id = IdWorker.getDefaultInstance().nextId();
genRecord(playerCardInfos.values().stream().collect(Collectors.toMap(PlayerCardInfoDouDiZhu::getUserId, PlayerCardInfoDouDiZhu::getScore)), room, id);
// 回放
replay.setId(id);
replay.setCount(playerCardInfos.size());
replay.setRoom_uuid(this.room.getUuid());
replay.setRoomInfo(this.room.toVo(0));
KafkaMsgKey kafkaMsgKey = new KafkaMsgKey().setMsgId(KAFKA_MSG_ID_REPLAY);
MsgProducer msgProducer = SpringUtil.getBean(MsgProducer.class);
msgProducer.send(IKafaTopic.CENTER_TOPIC, kafkaMsgKey, replay);
}
Aggregations