class DefaultAppScaleManager implements AppScaleManager {

    Observable<String> v3LiveStreamTargetUpdates() {
        return v3JobOperations.observeJobs()
                .filter(event -> {
                    if (event instanceof JobUpdateEvent) {
                        JobUpdateEvent jobUpdateEvent = (JobUpdateEvent) event;
                        return jobUpdateEvent.getCurrent().getStatus().getState() != JobState.Finished;
                    }
                    return false;
                })
                .cast(JobUpdateEvent.class)
                .flatMap(event ->
                        appScalePolicyStore.retrievePoliciesForJob(event.getCurrent().getId())
                                .filter(autoScalingPolicy -> shouldRefreshScalableTargetForJob(autoScalingPolicy.getJobId(),
                                        getJobScalingConstraints(autoScalingPolicy.getRefId(), autoScalingPolicy.getJobId())))
                                .map(this::sendUpdateTargetAction)
                                .map(AppScaleAction::getJobId)
                                .doOnError(e -> logger.error("Exception in v3LiveStreamTargetUpdates -> ", e))
                                .onErrorResumeNext(e -> Observable.empty())
                );
    }

    @Inject public  DefaultAppScaleManager(AppScalePolicyStore appScalePolicyStore, CloudAlarmClient cloudAlarmClient,
                                  AppAutoScalingClient applicationAutoScalingClient,
                                  V3JobOperations v3JobOperations,
                                  Registry registry,
                                  AppScaleManagerConfiguration appScaleManagerConfiguration,
                                  TitusRuntime titusRuntime);
    private  DefaultAppScaleManager(AppScalePolicyStore appScalePolicyStore, CloudAlarmClient cloudAlarmClient,
                                   AppAutoScalingClient applicationAutoScalingClient,
                                   V3JobOperations v3JobOperations,
                                   Registry registry,
                                   AppScaleManagerConfiguration appScaleManagerConfiguration,
                                   ExecutorService awsInteractionExecutor,
                                   TitusRuntime titusRuntime);
    @VisibleForTesting public  DefaultAppScaleManager(AppScalePolicyStore appScalePolicyStore, CloudAlarmClient cloudAlarmClient,
                                  AppAutoScalingClient applicationAutoScalingClient,
                                  V3JobOperations v3JobOperations,
                                  Registry registry,
                                  AppScaleManagerConfiguration appScaleManagerConfiguration,
                                  Scheduler awsInteractionScheduler,
                                  TitusRuntime titusRuntime);

}