Read this on the main serverless docs site¶
CMQ (Cloud Message Queue)¶
Using a pre-existing topic¶
In the following example we choose a pre-existing CMQ topic with name cmq_trigger. The function will be called every time a message is sent to the test-topic topic.
functions:
hello_world:
handler: index.main_handler
runtime: Nodejs8.9
events:
- cmq:
name: cmq_trigger
parameters:
name: test-topic
enable: true
Note: CMQ triggers are enabled by default.
Event Structure for CMQ Topic Trigger¶
When receiving a message, the specified CMQ Topic sends the following event data in JSON format to the bound SCF.