Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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

$trigger/messaging/publish

Messaging

Subscriptions

Upon Subscribe

$trigger/messaging/subscribe

Messaging

Subscriptions

Upon Unsubscribe

$trigger/messaging/unsubscribe

Messaging

Connection

User Connected

$trigger/messaging/user/connected

Messaging

Connection

User Disconnected

$trigger/messaging/user/disconnected

Messaging

Connection

Device Connected

$trigger/messaging/device/connected

Messaging

Connection

Device Disconnected

$trigger/messaging/device/disconnected

Data

Table

Created

$trigger/collection/created

Data

Table

Updated

$trigger/collection/updated

Data

Table

Deleted

$trigger/collection/deleted

Data

Item

Created

$trigger/data/created

Data

Item

Updated

$trigger/data/updated

Data

Item

Deleted

$trigger/data/deleted

Data

Item

Upserted

$trigger/data/upserted

User

n/a

Created

$trigger/user/created

User

n/a

Updated

$trigger/user/updated

User

n/a

Deleted

$trigger/user/deleted

Device

n/a

Created

$trigger/device/created

Device

n/a

Updated

$trigger/device/updated

Device

n/a

Deleted

$trigger/device/deleted

Edge/Platform

Platform

Platform Started

$trigger/startconnectdisconnect/platformstarted

Edge/Platform

Platform

Platform Connected on Edge

$trigger/startconnectdisconnect/platformconnectedonedge

Edge/Platform

Platform

Platform Disconnected on Edge

$trigger/startconnectdisconnect/platformdisconnectedonedge

Edge/Platform

Edge

Edge Started

$trigger/startconnectdisconnect/edgestarted

Edge/Platform

Edge

Edge Connected on Platform

$trigger/startconnectdisconnect/edgeconnectedonplatform

Edge/Platform

Edge

Edge Disconnected on Platform

$trigger/startconnectdisconnect/edgedisconnectedonplatform

Timer

n/a

Create Timer

$timer/{timerName}

...

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.