响应式编程

最后发布时间:2023-12-17 16:44:05 浏览量:
package io.seqera.tower.service.progress
    @Inject
    AuditEventPublisher auditEventPublisher
  @PostConstruct
    void init() {
        log.info "Creating workflow progress updater -- store=${store.getClass().getSimpleName()};"
        publisher = PublishSubject.create()

        publisher
                .observeOn(Schedulers.computation())
                .subscribe { doEvent(it) }
    }

    @Deprecated void create(String workflowId, List<String> processNames) {
        // defer the invocation
        publisher.onNext( { target.create(workflowId, processNames) } )
    }

    @Deprecated void updateStats(String workflowId, List<Task> tasks) {
        // defer the invocation
        publisher.onNext( { target.updateStats(workflowId, tasks) } )
    }
    void doEvent(event) {
        if( event instanceof Closure ) {
            event.call()
        }
        else {
            log.warn "Illegal progress event=$event"
        }
    }

快捷入口
java 思维导图 浏览PDF 下载PDF
分享到:
标签