首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Spring部署Zeebe

通过Spring部署Zeebe
EN

Stack Overflow用户
提问于 2020-06-07 19:37:42
回答 2查看 1.3K关注 0票数 0

我想通过部署多个BPMN文件

这就是我当前如何指定部署的方式。

代码语言:javascript
复制
@ZeebeDeployment(classPathResource = "customerFlow.bpmn")

对于如何部署两个以上的bpmn文件有什么建议吗?

参考资料:https://github.com/zeebe-io/spring-zeebe

编辑:

我确实尝试过这样的方法

代码语言:javascript
复制
@Autowired private ZeebeClient zeebeClient;

@PostConstruct
public void deploy(){
    final DeploymentEvent deployment = zeebeClient.newDeployCommand()
            .addResourceFromClasspath("customerFlow.bpmn")
            .send()
            .join();
}

收到以下错误:

代码语言:javascript
复制
Caused by: java.lang.IllegalStateException: delegate is not running!
    at io.zeebe.spring.util.ZeebeAutoStartUpLifecycle.get(ZeebeAutoStartUpLifecycle.java:38)
    at io.zeebe.spring.client.ZeebeClientLifecycle.newDeployCommand(ZeebeClientLifecycle.java:71)
    at com.lendingkart.flows.app.App.deploy(App.java:51)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-06-11 19:12:00

这似乎适用于我的案子

代码语言:javascript
复制
@Component
public class ZeebeDeployer {

    @Value("${zeebe.client.broker.contactPoint}")
    private String zeebeBroker;

    private static Logger logger = LoggerFactory.getLogger(ZeebeDeployer.class);

    @PostConstruct
    public void deploy(){
        try(ZeebeClient client = ZeebeClient.newClientBuilder()
                    // change the contact point if needed
                    .brokerContactPoint(zeebeBroker)
                    .usePlaintext()
                    .build();){

            client.newDeployCommand()
                .addResourceFromClasspath("abc.bpmn")
                .addResourceFromClasspath("xyz.bpmn")
                .send()
                .join();
        }catch (Exception e){
            //Todo: better to throw custom exception here
            logger.error("Zeebe deployment failed {}", e.getMessage(), e);
        }
    }
}
票数 0
EN

Stack Overflow用户

发布于 2020-06-09 12:48:32

您可以在DeploymentAnnoation中提交一个资源列表:

代码语言:javascript
复制
@ZeebeDeployment(classPathResources = {"customerFlow.bpmn", "secondFile.bpmn"})

我刚刚更新了自述文件,以反映这一点:

https://github.com/zeebe-io/spring-zeebe/blob/master/README.md#deploy-workflow-models

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62250649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档