use of com.netflix.titus.api.federation.model.Cell in project titus-control-plane by Netflix.
the class AggregatingJobServiceGateway method observeJobs.
@Override
public Observable<JobChangeNotification> observeJobs(ObserveJobsQuery query, CallMetadata callMetadata) {
final Observable<JobChangeNotification> observable = createRequestObservable(delegate -> {
Emitter<JobChangeNotification> emitter = new EmitterWithMultipleSubscriptions<>(delegate);
Map<Cell, JobManagementServiceStub> clients = CellConnectorUtil.stubs(cellConnector, JobManagementServiceGrpc::newStub);
final CountDownLatch markersEmitted = new CallbackCountDownLatch(clients.size(), () -> emitter.onNext(buildJobSnapshotEndMarker()));
clients.forEach((cell, client) -> {
StreamObserver<JobChangeNotification> streamObserver = new FilterOutFirstMarker(emitter, markersEmitted);
wrapWithNoDeadline(client, callMetadata).observeJobs(query, streamObserver);
});
});
return observable.map(this::addStackName);
}
Aggregations