Reputation: 307
I want to deploy multiple BPMN files via Spring Boot Zeebe starter
This is how I am currently specifying my deployment
@ZeebeDeployment(classPathResource = "customerFlow.bpmn")
Any suggestion on how to deploy more than two bpmn files?
Reference : https://github.com/zeebe-io/spring-zeebe
Edit:
I did try something like this
@Autowired private ZeebeClient zeebeClient;
@PostConstruct
public void deploy(){
final DeploymentEvent deployment = zeebeClient.newDeployCommand()
.addResourceFromClasspath("customerFlow.bpmn")
.send()
.join();
}
Received following error:
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)
Upvotes: 0
Views: 3319
Reputation: 81
Wildcards are also supported now like so:
@Deployment(resources = {"classpath*:/bpmn/**/*.bpmn", "classpath*:/dmn/**/*.dmn"})
This will deploy all files nested in a bpmn folder that end with .bpmn and all files nested in a dmn foldeer that end with .dmn
Reference: https://github.com/camunda-community-hub/spring-zeebe?tab=readme-ov-file#deploy-process-models
Upvotes: 0
Reputation: 307
This seems to be working for my case
@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);
}
}
}
Upvotes: 0
Reputation: 1030
You can hand over a list of resources in the DeploymentAnnoation:
@ZeebeDeployment(classPathResources = {"customerFlow.bpmn", "secondFile.bpmn"})
I just updated the readme to reflect this:
https://github.com/zeebe-io/spring-zeebe/blob/master/README.md#deploy-workflow-models
Upvotes: 3