Search in sources :

Example 1 with SnapshotEnd

use of com.netflix.titus.grpc.protogen.JobChangeNotification.SnapshotEnd in project titus-control-plane by Netflix.

the class CellWithFixedJobsService method observeJobs.

@Override
public void observeJobs(ObserveJobsQuery query, StreamObserver<JobChangeNotification> responseObserver) {
    // TODO: query criteria (filters) are not implemented
    for (Job job : jobsIndex.values()) {
        JobChangeNotification.JobUpdate update = JobChangeNotification.JobUpdate.newBuilder().setJob(job).build();
        JobChangeNotification notification = JobChangeNotification.newBuilder().setJobUpdate(update).build();
        responseObserver.onNext(notification);
    }
    SnapshotEnd snapshotEnd = SnapshotEnd.newBuilder().build();
    JobChangeNotification marker = JobChangeNotification.newBuilder().setSnapshotEnd(snapshotEnd).build();
    responseObserver.onNext(marker);
    final Subscription subscription = updates.subscribe(responseObserver::onNext, responseObserver::onError, responseObserver::onCompleted);
    GrpcUtil.attachCancellingCallback(responseObserver, subscription);
}
Also used : JobChangeNotification(com.netflix.titus.grpc.protogen.JobChangeNotification) SnapshotEnd(com.netflix.titus.grpc.protogen.JobChangeNotification.SnapshotEnd) Job(com.netflix.titus.grpc.protogen.Job) Subscription(rx.Subscription)

Aggregations

Job (com.netflix.titus.grpc.protogen.Job)1 JobChangeNotification (com.netflix.titus.grpc.protogen.JobChangeNotification)1 SnapshotEnd (com.netflix.titus.grpc.protogen.JobChangeNotification.SnapshotEnd)1 Subscription (rx.Subscription)1