hi..
i'm trying to create a situation, where the channel will always try to connect and re-connect whether the destination is down, or got disconnected,
so i'm trying to use notifyStateChanged like so:
final Grpc.Stub stub= Grpc.newStub(channel).withCallCredentials(callCredentials);
final ConnectivityState state = channel.getState(true);// this should force a connection
channel.notifyWhenStateChanged(ConnectivityState.IDLE, new Runnable() {
@Override
public void run() {
final ConnectivityState state = channel.getState(true);
if (ConnectivityState.READY.equals(state)){
final StreamObserver<GrpcProtoSpec.EventRecord> observer = createObserver(event, eventTypes);
stub.getEvents(request, observer);
}
channel.notifyWhenStateChanged(state,this);
}
});
could this be enough?