Search in sources :

Example 11 with ResponseRobotVo

use of com.code.server.game.poker.robot.ResponseRobotVo 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);
}
Also used : ServerConfig(com.code.server.game.poker.config.ServerConfig) HashMap(java.util.HashMap) MsgProducer(com.code.server.kafka.MsgProducer) KafkaMsgKey(com.code.server.constant.kafka.KafkaMsgKey) ResponseRobotVo(com.code.server.game.poker.robot.ResponseRobotVo)

Aggregations

KafkaMsgKey (com.code.server.constant.kafka.KafkaMsgKey)11 ServerConfig (com.code.server.game.poker.config.ServerConfig)11 ResponseRobotVo (com.code.server.game.poker.robot.ResponseRobotVo)11 MsgProducer (com.code.server.kafka.MsgProducer)11 HashMap (java.util.HashMap)11 CardStruct (com.code.server.constant.game.CardStruct)1