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:

  1. Navigate to Event Listeners under Amplify in the remote console.

catalyst_workdrive_event_listener

  1. Click View on the Catalyst Component Events tile to open it, then click Create Rule.

catalyst_workdrive_create_rule_1

  1. Enter the name of the rule as “WorkDriveSync”.

catalyst_workdrive_create_rule_2

  1. 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.

catalyst_workdrive_create_rule_3
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.

  1. Click Create.

The rule is now created and displayed in the component event listeners section.

catalyst_workdrive_rule_created

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 2023-12-15 18:54:08 +0530 +0530

RELATED LINKS

Event Listeners