...
Microservice: A short-lived service expected to be completed within a fixed time (or is killed otherwise); default execution timeout is 60 seconds.
Stream service: A service configured to handle requests continuously with an infinite execution timeout.
Configuration: A library that contains a key-value object to be used as constants.
Library: A custom JavaScript library that can be imported into one or more code services.
Here is a code service tutorial.
Purpose
Microservices, a software development technique, allows for a high degree of modularity, scale, and parallelization – all essential for effectively building and running full-scale IoT applications.
...
A service can be invoked by:
1. A REST request to the API endpoint
2. Trigger event
3. Timer event
Our SDKs can be used as a REST client to accomplish the first REST option.
...
resp
is an object used to return values and exit the Code Service
. These methods are available in the resp
object:
...
$trigger
and $timer
are custom ClearBlade topics. Using a stream service instead of a micro-service is advisable when working with $timer
and $trigger
topics that often fire to prevent overloading the platform.
For more information on publishing event topics, click here.
Asset | Category | Action | Topic |
---|---|---|---|
Messaging | Publish | Publish |
|
Messaging | Subscriptions | Upon Subscribe |
|
Messaging | Subscriptions | Upon Unsubscribe |
|
Messaging | Connection | User Connected |
|
Messaging | Connection | User Disconnected |
|
Messaging | Connection | Device Connected |
|
Messaging | Connection | Device Disconnected |
|
Data | Table | Created |
|
Data | Table | Updated |
|
Data | Table | Deleted |
|
Data | Item | Created |
|
Data | Item | Updated |
|
Data | Item | Deleted |
|
Data | Item | Upserted |
|
User | n/a | Created |
|
User | n/a | Updated |
|
User | n/a | Deleted |
|
Device | n/a | Created |
|
Device | n/a | Updated |
|
Device | n/a | Deleted |
|
Edge/Platform | Platform | Platform Started |
|
Edge/Platform | Platform | Platform Connected on Edge |
|
Edge/Platform | Platform | Platform Disconnected on Edge |
|
Edge/Platform | Edge | Edge Started |
|
Edge/Platform | Edge | Edge Connected on Platform |
|
Edge/Platform | Edge | Edge Disconnected on Platform |
|
Timer | n/a | Create Timer |
|
...
A webhook is a mechanism that allows you to execute a code service by targeting a public endpoint. Any HTTP method, such as GET, POST, PUT, or DELETE, can be used and will result in executing the service. The URL we provide can be used by third parties to push real-time data to ClearBlade’s server. Multiple webhooks can invoke a code service and are syncable. See the tutorial.