title: async grpc server handling multiple types of request
body: <p>Is there a better example on how to implement multiple async requests. </p>
  
  <pre><code> // The greeting service definition.
  service Greeter {
    // Sends a greeting
    rpc ListSayHello1 (HelloRequest1) returns (stream HelloReply1) {}
    rpc ListSayHello2 (HelloRequest2) returns (stream HelloReply2) {}
  }
  
  // The request message containing the user's name.
  message HelloRequest1 {
    string name = 1;
  }
  
  message HelloRequest2 {
    string name = 1;
  }
  
  // The response message containing the greetings
  message HelloReply1 {
    string message = 1;
  }
  
  message HelloReply2 {
    string message = 1;
  }
  </code></pre>
  
  <p>I am using below async pattern to handle <code>SayHello1</code>, but now I want to add support for <code>SayHello2</code>. What should be the approach? </p>
  
  <pre><code> new CallData(&amp;service_, cq_.get(), *this);
      void* tag;  // uniquely identifies a request.
      bool ok;
      while (true) {
          // Block waiting to read the next event from the completion queue. The
          // event is uniquely identified by its tag, which in this case is the
          // memory address of a CallData instance.
          // The return value of Next should always be checked. This return value
          // tells us whether there is any kind of event or cq_ is shutting down.
          GPR_ASSERT(cq_-&gt;Next(&amp;tag, &amp;ok));
          GPR_ASSERT(ok);
          static_cast&lt;CallData*&gt;(tag)-&gt;Proceed();
      }
  </code></pre>
  
  <p>In <code>CallData</code>, I doing this </p>
  
  <pre><code>void CallData::Proceed()
  {
      if (status_ == CREATE) {
  
          status_ = PROCESS;
          service_-&gt;RequestListSayHello1(&amp;ctx_, &amp;request_, &amp;writer_, cq_, cq_,
              this);
      }
  ... 
  }
  </code></pre>