cancel
Showing results for 
Search instead for 
Did you mean: 

Packaging the .bpmn files

davanna
Champ in-the-making
Champ in-the-making
Hi,

I am using the spring boot to run my workflows using activiti. I have put my .bpmn files under src/main/resources/processes/ and the engine is picking up properly. As I have multiple flows, I would like to group the bpmn files along with the use case. Hence I would like to put all the related .bpmn files under a specific folder. For example - src/main/resources/processes/UseCase1. If I do this way, the engine does not deploy any files as there are no files under processes but under /processes/UseCase1. Can you let me know what config setting that I should do that it can pick from my UseCase1 folder.

Thanks
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
No, that's not there out of the box. You'll need to add that yourself. In Activiti-Spring this is done by the following code: https://github.com/Activiti/Activiti/tree/master/modules/activiti-spring/src/main/java/org/activiti/..., which might be an inspiration.

davanna
Champ in-the-making
Champ in-the-making
Thanks for the reply.

davanna
Champ in-the-making
Champ in-the-making
I wrote the code for the use case that I require here. But I see that following code in AbstractProcessEngineConfiguration.java reads .bpmn files from the passed process folder. If I need to add functionality to read even sub-folders, I need to add a variable in activitiproperties like 'readBPMfromAddtionalFolder' which is true or false so that based on this value, I can read .bpm files from the folders within 'process' folder. I want to take this route as I do not want to break the existing functionality. Hence wanted to run this across you. I am using Spring-boot for my development. The SpringProcessEngineConfiguration.java calls the below method which is defined in AbstractProcessEngineConfiguration.java.

<code>
public List<Resource> discoverProcessDefinitionResources(ResourcePatternResolver applicationContext, String prefix, List<String> suffixes, boolean checkPDs) throws IOException {
    if (checkPDs) {

     List<Resource> result = new ArrayList<Resource>();
     for (String suffix : suffixes) {
      String path = prefix + suffix;
      Resource[] resources = applicationContext.getResources(path);
      if (resources != null && resources.length > 0) {
       for (Resource resource : resources) {
        result.add(resource);
       }
      }
     }
    
     if (result.isEmpty()) {
       logger.info(String.format("No process definitions were found for autodeployment"));
     }
    
      return result;
    }
    return new ArrayList<Resource>();
  }
</code>