Make sure you have installed iii before proceeding. If you haven’t then visit the
Install guide first.
1. Create the project
2. Start the engine
ws://localhost:49134. Keep this terminal open and open a second
terminal in the quickstart directory for the remaining commands.
3. Start the Python worker
Workers only need a WebSocket connection to the iii engine. They can run locally, in the cloud,
replicated in kubernetes, or anywhere else.
math::add with the engine. You could call this function right
now using the command below.
4. Start the TypeScript worker
math::add_two_numbers with the engine.
5. Call across languages
Call the TypeScript worker. It will call the Python worker through the engine and return the result:6. Add state
Theiii worker add command incrementally adds workers from the registry to your running system.
Start by adding the state worker, which gives every function access to a persistent key-value store.
From the folder containing iii’s config.yaml run:
workers/math-worker/math_worker.py in your code editor and uncomment the state block so
the handler looks like this:
math::add_two_numbers.
7. Add HTTP endpoints
Now let’s add an HTTP worker to expose your functions as REST endpoints. From the folder containing iii’sconfig.yaml run:
workers/caller-worker/src/worker.ts and uncomment the HTTP block at the bottom of the file:
iii trigger now also respond to HTTP requests with no code
changes to the handlers themselves.
How it works
For a walkthrough of how the engine, workers, functions, and triggers in this scaffold fit together, see Understanding iii. It uses this project as the worked example.Next Steps
You scaffolded a project, started two workers in different languages, called functions across them, added persistent state, and exposed everything over HTTP, all by incrementally adding workers to a running system.Use iii
Learn how to use iii in production.
Understanding iii
Understand functions, triggers, and workers from a conceptual point of view.