Search in sources :

Example 1 with SimpleList

use of com.hry.spring.grpc.mystream.SimpleList in project spring_boot by hryou0922.

the class HelloStreamClient method server2ClientRpc.

/**
 * 阻塞服务器流
 */
public void server2ClientRpc(int num1, int num2) {
    logger.info("request server2ClientRpc num1={}, num2={}", num1, num2);
    Simple simple = Simple.newBuilder().setName("simple2" + num1).setNum(num1).build();
    Simple simple2 = Simple.newBuilder().setName("simple2" + num2).setNum(num2).build();
    SimpleList simpleList = SimpleList.newBuilder().addSimpleList(simple).addSimpleList(simple2).build();
    Iterator<SimpleFeature> simpleFeatureIter = blockingStub.server2ClientRpc(simpleList);
    for (int i = 1; simpleFeatureIter.hasNext(); i++) {
        SimpleFeature feature = simpleFeatureIter.next();
        logger.info("Result {} : {}", i, feature);
    }
}
Also used : SimpleList(com.hry.spring.grpc.mystream.SimpleList) SimpleFeature(com.hry.spring.grpc.mystream.SimpleFeature) Simple(com.hry.spring.grpc.mystream.Simple)

Aggregations

Simple (com.hry.spring.grpc.mystream.Simple)1 SimpleFeature (com.hry.spring.grpc.mystream.SimpleFeature)1 SimpleList (com.hry.spring.grpc.mystream.SimpleList)1