Develop File Integration¶
This section shows you how to create a file integration using WSO2 Integrator: BI. The integration listens to events in a directory and triggers when file-related events occur.
Step 1: Create a new integration project¶
- Click the BI icon on the sidebar.
- Click the Create New Integration button.
- Enter the project name as
LocalFilesIntegration. - Select Project Directory and click the Select Location button.
-
Click the Create New Integration button to create the integration project.
Step 2: Create a Local Files Integration¶
- In the design view, click the Add Artifact button.
- Select Local Files under the File Integration category.
-
Enter the path to the directory you want to monitor. For example,
/user/home/Downloads.Use configurable variables
Use a configurable variable for the path (e.g.,
monitorPath) so it can be changed at deployment time without code changes. See Managing Configurations for more details. -
Click the Create button to create the Local Files Integration.
Step 3: Configure file event resources¶
-
Click the Add Handler button and select the onCreate handler.
-
Click the onCreate function to navigate to the function implementation designer view.
- Click + and select Log Info from the node panel under the Logging category.
- In the Msg field, type
File createdand use the Helper Panel to select Inputs -> event -> name. -
Click the Save button to add the log action to the function.
-
Repeat the above steps to add the onDelete and onModify functions to the service.
- For the onDelete function, type
File deletedin the Msg field and use the Helper Panel to select Inputs -> event -> name. - For the onModify function, type
File modifiedin the Msg field and use the Helper Panel to select Inputs -> event -> name. -
The final service will look like this:
Step 4: Run the integration¶
- Click the Run button in the top-right corner to run the integration.
- The integration will start listening to the events in the directory specified in step 2.
- Create a new file in the directory to trigger the onCreate event.
- Modify the file to trigger the onModify event.
- Delete the file to trigger the onDelete event.
-
The log messages will be displayed in the console.





