class AwsObservableExt {

    public static Completable asyncActionCompletable(Func1<CompletableHandlerSupplier, Future<?>> action) {
        return Completable.create(subscriber -> {
            try {
                final Future<?> result = action.call(new CompletableHandlerSupplier(subscriber));
                subscriber.onSubscribe(Subscriptions.create(() -> result.cancel(true)));
            } catch (Throwable t) {
                Exceptions.throwIfFatal(t);
                subscriber.onError(t);
            }
        });
    }

}