Beispiel #1
0
    void PingEvent(bond::ext::grpc::unary_call<PingRequest, bond::reflection::nothing> call) override
    {
        PingRequest request = call.request().Deserialize();

        printf("Received event \"%s\"\n", request.Payload.c_str());
        fflush(stdout);

        NumEventsReceived++;

        Countdown.set();
    }
Beispiel #2
0
    void SayHello(
        bond::ext::gRPC::unary_call<
            bond::bonded<HelloRequest>,
            HelloReply> call) override
    {
        HelloRequest request = call.request().Deserialize();

        HelloReply reply;
        reply.message = "hello " + request.name;

        call.Finish(reply);
    }
Beispiel #3
0
    void Ping(bond::ext::grpc::unary_call<PingRequest, PingResponse> call) override
    {
        PingRequest request = call.request().Deserialize();

        switch (request.Action)
        {
            case PingAction::Identity:
            {
                printf("Received identity request \"%s\"\n", request.Payload.c_str());
                fflush(stdout);

                PingResponse response;
                response.Payload = request.Payload;

                NumRequestsReceived++;

                call.Finish(response);
                Countdown.set();
                break;
            }

            case PingAction::Error:
            {
                printf("Received error request \"%s\"\n", request.Payload.c_str());
                fflush(stdout);

                NumErrorsReceived++;

                call.Finish({ ::grpc::StatusCode::UNIMPLEMENTED, "Application Exception" });
                Countdown.set();
                break;
            }

            default:
            {
                printf("Received unknown request \"%s\"\n", request.Payload.c_str());
                fflush(stdout);

                call.Finish({ ::grpc::StatusCode::UNIMPLEMENTED, "Unknown PingAction" });
                Countdown.set();
                break;
            }
        }
    }