Help & DocumentationServerless Cloud FunctionBest PracticesMapReduce Method that Uses WordCount as an ExampleStep 4. Add Trigger
If you complete "Step 3: Create Mapper and Reducer Functions and Test", and the test result meets the expectation, you can add COS configurations so that COS can publish events to SCF and call the function.
1) In the details page of the Mapper function you just created, select the Triggering Method tab, and click Add trigger mode.
2) Select COS trigger for the trigger method, srcmr
created in Step 1: Prepare COS Bucket for COS Bucket, and File Upload for the event type, and then click Save.
In this way, you have completed all steps. You can test the configuration by following the steps below:
- Go to the COS Console, select
src
, upload a .txt text file, and check whether a similar file is generated indestmr
after a certain period of time. - You can monitor the function activities in the Serverless Cloud Function Console, and select Log to check the logs in which the calling of the function is recorded.