支持@HystrixCommand for rx.Observable

时间:2018-03-02 20:15:59

标签: hystrix

我正在尝试将@hystrixcommand与rx.Observable一起使用。以下是代码段。 问题是Hystrix属性的超时设置似乎不起作用,10秒后超时方法没有调用,请帮助。

@HystrixCommand(fallbackMethod = "assignActionsToUserFallback", commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "10000")})
    public Observable<Void> assignActionsToUser(List<String> actions, String newUserId, Date startTime,
                                                Date endTime, String lastUpdUserId) {
        return Observable.fromCallable(() -> {
            _log.info("HystrixObservableUtil :: Assign actions to user start");
            externalUserManagementService.assignActionsToUser(actions, newUserId, startTime, endTime, lastUpdUserId);
            _log.info("HystrixObservableUtil :: Assign actions to user end");
            return null;
        });
    }

private void assignActionsToUserFallback(List<String> actions, String newUserId, Date startTime,
                                             Date endTime, String lastUpdUserId) {
        System.out.println("Error........");

    }

来电者 -

Observable<Void> assignUserActionObservable = hystrixObservableUtil.assignActionsToUser(
                actions, newUserId, start.getTime(), end.getTime(), "EXTTMS").subscribeOn(Schedulers.io());

0 个答案:

没有答案