liian2019
V2EX  ›  Java

关于 flowable 的一个问题

  •  
  •   liian2019 · Mar 1, 2023 · 1679 views
    This topic created in 1196 days ago, the information mentioned may be changed or developed.

    我是用了 flowable 的 PROCESS_STARTED 事件监听,但是拿不到随流程启动设置的全局变量怎么办呢? 启动一个流程的时候走到监听器,但是 act_hi_varinst 和 act_ru_variable 都没有数据。 请问有大佬知道怎么处理吗

            List<HistoricVariableInstance> paramList = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
    
            Map<String,Object> params = new HashMap<>();
    
            if (!CollectionUtils.isEmpty(paramList)){
    
                for (HistoricVariableInstance variable : paramList){
    
                    params.put(variable.getVariableName(),variable.getValue());
    
                }
    
            }
    
            return params;
    
    dengji85
        1
    dengji85  
       Mar 1, 2023
    我用过 activiti ,流程还没结束,应该用运行时服务查询流程变量吧?
    AmaQuinton
        2
    AmaQuinton  
       Mar 2, 2023
    activiti 中, 在全局监听器里面使用 runtimeService.getVariables 获取变量, 数据存储在 activiti.ACT_RU_VARIABLE 表里, 根据 processInstanceId 或者 executionId 可以查到, flowable 和 activiti 类似, 你可以参考一下
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2881 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 15:23 · PVG 23:23 · LAX 08:23 · JFK 11:23
    ♥ Do have faith in what you're doing.