Search in sources :

Example 1 with SupervisorServiceBlockingStub

use of com.netflix.titus.grpc.protogen.SupervisorServiceGrpc.SupervisorServiceBlockingStub in project titus-control-plane by Netflix.

the class SupervisorObserveEventsCommand method execute.

@Override
public void execute(CommandContext context) {
    SupervisorServiceBlockingStub stub = GrpcClientErrorUtils.attachCallHeaders(SupervisorServiceGrpc.newBlockingStub(context.createChannel()));
    stub.observeEvents(Empty.getDefaultInstance()).forEachRemaining(event -> {
        switch(event.getEventCase()) {
            case MASTERINSTANCEUPDATE:
                logger.info("Add/updated: {}", SupervisorGrpcModelConverters.toCoreMasterInstance(event.getMasterInstanceUpdate().getInstance()));
                break;
            case MASTERINSTANCEREMOVED:
                logger.info("Removed: {}", event.getMasterInstanceRemoved().getInstanceId());
                break;
        }
    });
}
Also used : SupervisorServiceBlockingStub(com.netflix.titus.grpc.protogen.SupervisorServiceGrpc.SupervisorServiceBlockingStub)

Aggregations

SupervisorServiceBlockingStub (com.netflix.titus.grpc.protogen.SupervisorServiceGrpc.SupervisorServiceBlockingStub)1