Hi all,
I am facing some problems trying to close a Server-Stream call from the client side.
The client opens the channel, create the stub, etc and try to perform the call which returns an Iterator<Item>.
The grpc java examples show how to read the data from this Iterator is using for example a while loop, but not how the client could close it (onle the server can do so)
<code>
Iterator<Item> response = stub.getData()
while(response.hasNext())
{
response.next();
}
</code>
In case I want to close this call, what is the best way to do it? or at least something that makes it works?
I have tried out something like this, whenever it goes out of the while loop it will "destroy, cancel" the iterator, but it does not work:
<code>
Iterator<Item> response = stub.getData()
while(response.hasNext() && !condition)
{
response.next();
}
response = null;
</code>
Kind regards,
Rafael.