package com.ywt.mg.configs;

import com.ywt.gapi.base.file.FileServiceGrpc;
import com.ywt.gapi.user.DoctorServiceGrpc;
import io.grpc.Channel;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ServiceGrpcStubBeans {

    @Resource(name = "agentChannel")
    private Channel agentChannel;

    @Bean(name = "doctorServiceBlockingStub")
    public DoctorServiceGrpc.DoctorServiceBlockingStub getDoctorServiceBlockingStub() {
        return DoctorServiceGrpc.newBlockingStub(agentChannel);
    }

    @Bean(name = "fileServiceBlockingStub")
    public FileServiceGrpc.FileServiceBlockingStub getFileServiceBlockingStub() {
        return FileServiceGrpc.newBlockingStub(agentChannel);
    }

}

