Invoke the Function

Once the Function is running, it's ready to be invoked.

  1. To invoke a function, create a Trigger by clicking Functions > Trigger.
    Note: A Trigger is a component that is capable of invoking serverless Functions from an event source. Trigger works as a listener to a particular endpoint.
  2. Click Add.
  3. In the New Event Trigger panel, enter the Trigger description and Type.
  4. Under Config, enter the host as mqtt.swx.altairone.com.
  5. Enter your MQTT username and password same as in Interface tab inside the Thing in AnythingDB or Autogenerate it.
  6. Add Topic as follows:
    status/Your space name/collections/Your collection’s name/things/Your thing ID/properties/cpu
  7. Click Create Trigger.
  8. To test the Trigger, you can update the CPU property to a high number, such as 90.
    The Computer status property updates, and the Invocation count changes to 1.
    This Trigger points to the property CPU, of the thing “Your Thing ID” that is in the collection “Your collection’s name” inside the space “Your space name”.


    Figure 1.