package com.ywt.controller;

import com.ywt.gapi.mq.ExecuteGRPCRequest;
import com.ywt.gapi.mq.ExecuteGRPCResponse;
import com.ywt.gapi.mq.MQExecutorService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Consumer{
    @DubboReference
    private MQExecutorService mqExecutorService;


    @GetMapping("/tri")
    public void tri(){
        try {
            System.out.println(1111);
            ExecuteGRPCRequest request = ExecuteGRPCRequest.newBuilder().setMethod("21").build();
            ExecuteGRPCResponse response =  mqExecutorService.executeGRPC(request);
            System.out.println("Receive result ======> " + response.getMsgId());
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
