If you had the opportunity to work with WSO2 BPS or WSO2 BPMN, you’re familiar with the concept of variables. Just like in other programming languages, variable is in charge to hold some data and the system can make calculations and decisions based on such values. In this article I’ll show you how to read properties from the config file and to include them in your BPMN process definition. This can be very handy as, once you want to change something, it’s not necessary to recompile the code, redeploy the .bar file, even you don’t have to restart the product.
First of all, you need to create a new file call myconfig.properties and place it into EI-HOME/wso2/business-process/conf folder, with such content:
public HashMap<String, String> getProperties(){ return this.properties; }
}
Once you build this, place the .jar file into EI-HOME/lib and restart the product. That’s the first part. The artifact you’ve created you’ll call from BPMN in order to read and initialize all the variables from myconfig.properties.
Open WSO2 Developer Studio and start creating new process.
Right after the START EVENT add new Service Task and make sure you’re calling the right package / class you’ve made in the previous step:
From there you can add your own workflow stuff. In this step system will execute the service task and that task will invoke your code and pull the variables. As soon as you change the content of the properties file, new process instances will use updated values.
I hope this blog was helpful. If you have any questions regarding this blog, please ask them in the comment section below.
{{cta(‘d96cddee-168c-42a5-a0b6-00a670e766b7’)}}
About Dusan Dević
Dusan is a passionate full-stack developer with more then 6 years of experience, especially with web development. He is very interested in IoT and modern technology in general. From 2015 he works as Integration Consultant at Yenlo, mostly with WSO2-IS, WSO2-DAS, Java and AngularJS.
Our services to facilitate the digital transformation of your business
WSO2
Solutions by industry
Learnings
Our Technologies for your Digital Transformation
Search
What kind of content are you looking for?
We appreciate it
Care to share
Please select one of the social media platforms below to share this pages content with the world
Manage Cookie Consent
This website uses cookies. Information about data processing can be found in our privacy policy.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.