package com.wecloud.im.router;

import com.wecloud.im.ws.sender.ChannelSender;
import io.geekidea.springbootplus.framework.util.IpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
@DubboService
public class RouterSendServiceImpl implements RouterSendService {

    @Autowired
    private ChannelSender channelSender;

    @Override
    public Boolean sendMsgRemote(Long clientId, Integer platform, String msg) {
        log.info("接收到rpc调用，本地ip {}", IpUtil.getLocalhostIp());
        return channelSender.sendMsgLocal(clientId, platform, msg);
    }

    @Override
    public void batchSendMsgRemote(List<String> sendRouterKeys, String msg) {
        channelSender.batchSendMsgLocal(sendRouterKeys, msg);
    }
}
