How to implement Asynchronous chain request by grpc-rpc

A chained call to a grpc request needs to be implemented in the business. The service flow is as follows:

client- > serverA- > serverB

the code to create the CallData, on the grpc server is as follows:

class CallData {
    public:
        CallData(Save::AsyncService *service, ServerCompletionQueue *completionQueue) :
                status_(CREATE),
                service_(service),
                completionQueue_(completionQueue),
                responder_(&context_) {
            //Invoke the sereving logic right away
            Proceed();
        }

        void Proceed() {
            if (CREATE == status_) {
                status_ = PROCESS;
                service_->Request(&context_, &request_, &responder_, completionQueue_, completionQueue_, this);
            } else if (PROCESS == status_) {
                new CallData(service_, completionQueue_, sender_);
                
                //
                
                status_ = FINISH;
                responder_.Finish(reply_, Status::OK, this);
            } else {
                GPR_ASSERT(FINISH == status_);
                delete this;
            }
        }

    private:
        enum CallStatus {
            CREATE, PROCESS, FINISH
        };
        CallStatus status_;
        
        //
    };

Proceed in CallData did not think of how to proceed with the next asynchronous request and how to handle the returned result. Ask for advice!

Mar.04,2021

class CallData {

public:
    CallData(Save::AsyncService *service, ServerCompletionQueue *completionQueue) :
            status_(CREATE),
            service_(service),
            completionQueue_(completionQueue),
            responder_(&context_) {
        //Invoke the sereving logic right away
        Proceed();
    }

    void Proceed() {
        if (CREATE == status_) {
            status_ = PROCESS;
            service_->Request(&context_, &request_, &responder_, completionQueue_, completionQueue_, this);
            
            **doSomeThing();**
            
            
        } else if (PROCESS == status_) {
            new CallData(service_, completionQueue_, sender_);
            
            //
            
            status_ = FINISH;
            responder_.Finish(reply_, Status::OK, this);
        } else {
            GPR_ASSERT(FINISH == status_);
            delete this;
        }
    }

private:
    enum CallStatus {
        CREATE, PROCESS, FINISH
    };
    CallStatus status_;
    
    //
};
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47c99-4391c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47c99-4391c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?