Working with Read Tasks
Let's take a simple scenario where a BPMN process reads some content (text message) that is stored in the product registry and passes the message to a target variable.
Let's get started! This tutorial includes the following sections:
Creating the artifacts
Follow the steps below to create the requires artifacts.
Creating a registry resource
In this tutorial, the READ task will be configured to read content from a registry resource. See the instructions below to create a registry resource.
Create a text file named TestBPMN.txt with the following text content: 'Sample content stored in the registry'
Create a registry resource project:
Open WSO2 Integration Studio and click Miscellaneous → Create New Registry Project in the Getting Started view as shown below.
In the dialog that opens, enter a name for the registry project.
Click Finish and see that the project is now listed in the project explorer.
Add the TestBPMN.txt file to the conf directory of the product registry:
Right-click the registry resource project in the left navigation panel, click New, and then click Registry Resource. This will open the New Registry Resource window.
Select the Import from file system option as shown below and click Next.
Click Browse file and select the TestBPMN.txt file that you created.
In the Registry field, select conf as the registry directory.
In the Registry path to deploy field, set repository/ as the path.
In the Save Resource in field, select the existing registry resource project.
Click Finish.
Creating the BPMN artifacts
Create a new BPMN project named ReadTaskBPMN. For instructions, see Creating a BPMN Project.
Create a BPMN diagram named ReadTask.bpmn. For instructions, see Creating the BPMN Diagram.
Click anywhere on the canvas, go to the Properties tab, and fill in the following details:
To implement the process, drag and drop a Start Event element, a Read Task element, a User Task element, and an End Event element to the canvas.
Configuring the Read task
Now, let's configure the READ task to read the content from the registry resource (TestBPMN resource) and write it to a specific target.
Select the READ task in the diagram, go to the Properties/Main Config tab, and enter the following configurations:
Resource | Origin | Target | Type |
|---|---|---|---|
conf:/repository/TestBPMN.txt | REGISTRY | testing | string |
The descriptions of the properties are as follows:
Property | Description |
|---|---|
Resource | The name of the resource. If the resource is a registry resource, this should be resource path. |
Origin | The origin or source of the resource. Supported sources:
|
Target | The target variable name that should be populated with the content that is read by the task. |
Type | The type of variable. The content read by this task will be parsed/converted to a given type. The supported types: |
Configuring the User Task
Select the User task and apply property values:
Go to the Properties/Main config tab and enter admin in the Assignee field.
Go to the Properties/Form tab and enter the following configurations:
Deploying the artifacts
Follow the steps below to deploy the registry artifacts.
Create a composite applicaition project (C-App project) to package the registry resource:
Open the Getting Started view and click Miscellaneous → Create New Composite Application .
In the New Composite Application Project dialog that opens, select the registry project and click Finish.
In the Composite Application Project POM Editor that opens, under Dependencies, set the server role of the registry resource to Business Process Server as shown below.
Export a CAR file of with the registry artifacts:
Be sure the the registry resource is selected as a dependency in th C-App project.
Right-click the C-App project and select Export Composite Application Project from the pop-up menu. Alternatively, open the
pom.xmlfile in the Composite Application Project POM Editor and click the button for creating an archive in the upper-right corner.Specify a location to save the CAR file.
You have now exported the registry resource into a single CAR file.
Deploy the CAR file in the Business Process server of WSO2 EI:
Start the Business Process profile.
Open the management console of the Business Process profile.
Go to Main → Carbon Applications → Add and select the CAR file.