Create Stream Workers
This page explains how to create stream workers in Macrometa, assuming you have the stream worker definition written already. To learn more about writing stream workers, refer to Stream Worker Basics or look at Stream Worker Examples.
After you create the stream worker, it is saved in an inactive, unpublished state. For instructions on how to publish (activate) it, refer to Publish/Unpublish Stream Workers.
- Web Console
- SDK
- REST API
- CLI
Follow these instructions to create a new stream worker using the GDN console web UI.
Click Compute > Stream Workers.
If you already have a stream worker written, then paste the code in the Editor tab and skip the following substeps. Otherwise, click New Stream Worker.
In the Name field, enter a name for your stream worker. No spaces or special characters are allowed except hyphens (-) and underscores (_). Best practice is not write a name that describes what the stream worker does.
(Optional) Enter a description. Best practice is to include a description so that other users (or future you) understand what the stream worker is for.
Click Create.
Macrometa creates metadata with the information that you entered.
Enter the rest of your stream worker code.
(Optional) Click Validate.
Macrometa validates your stream worker code and displays an error if it is invalid.
Click Save.
Select edge locations to which your stream worker will be deployed and then click Save.
Your stream worker is now created in an unpublished state. To publish it, click Publish.
To see how to create stream workers with the Macrometa Python SDK or JavaScript SDK, refer to the Stream Workers SDK Example.
Use our interactive API Reference with code generation in 18 programming languages to:
- Validate a Stream Worker Definition
- Create a Stream Worker - Note that if you set
isActive
totrue
, then this command publishes the stream worker as well.
Use the gdnsl stream-worker create CLI command to validate and create an unpublished stream worker.