Create an Event Listener
Let’s now create a rule in the Catalyst component Event Listener that is present in your project by default.
The component event listener can link an event that occurred in one of the Catalyst components to the execution of a target event function. In our case, the component is the File Store. A rule in this event listener is associated with a specific instance of the component , i.e., the specific folder we associate it with. We will configure the action as listening for a file upload in this folder.
To create a rule in the component event listener:
- Navigate to Event Listener component in the remote console.
- Click on the Catalyst Component Events tile to open it, then click Create Rule.
- Enter the name of the rule as “WorkDriveSync”.
- Select the component as File Store from the dropdown list. Select the folder WorkDrive that you created in the File Store, and the action Upload. You must then select the Java or Node.js Event function i.e., WorkDrive or workdrivesync as the target function.
When you select the File Store component, the page will display a sample structure of the data that will be passed to the target function for this component.
- Click Create.
The rule is now created and displayed in the component event listeners section.
This rule will now trigger the event function each time a file is uploaded in the folder, and will pass the event data along with the uploaded file to the function.
WorkDrive Sync app is now fully configured.
Last Updated 2024-06-12 17:37:03 +0530 +0530