yomo run
Run a StreamFunction service.
Usage
yomo run [flags] serverless
Flags
-d, --credential
: Set the credential when connecting to Zipper.-m, --modfile
: Set the path of customgo.mod
file.-n, --name
: Set the name of the StreamFunction service, it should match the specific name in Zipper config file.-r, --runtime
: Set the runtime of the StreamFunction service, default is WebAssembly bywazero
, also supportwasmtime
,wasmedge
andDeno
-z, --zipper
: Set the address of Zipper to connect.
Example
Follow last tutorial: yomo build, we created a Stream Function accumulator-func
, and build it to WebAssembly, and we try run it by yomo dev
, Now we will run it with yomo run
command.
ᐅ yomo run -z tap.yomo.dev:9140 -n yomo-app-demo sfn.wasm
ℹ️ YoMo Stream Function file: sfn.wasm
⌛ Create YoMo Stream Function instance...
ℹ️ Starting YoMo Stream Function instance with executable file: sfn.wasm. Zipper: [tap.yomo.dev:9140].
ℹ️ YoMo Stream Function is running...
time=2023-04-16T22:45:54.265+08:00 level=INFO msg="use credential" component="Stream Function" client_id=jHp0g18hmjk_fL0SvH_6X client_name=yomo-app-demo credential_name=none
time=2023-04-16T22:45:55.461+08:00 level=INFO msg="connected to zipper" component="Stream Function" client_id=jHp0g18hmjk_fL0SvH_6X client_name=yomo-app-demo zipper_addr=tap.yomo.dev:9140
sfn received 58 bytes: {"noise":68.54317,"time":1681656355561,"from":"localhost"}
⚡️avg=68.543170
sfn received 59 bytes: {"noise":105.43603,"time":1681656355663,"from":"localhost"}
⚡️avg=86.989600
sfn received 59 bytes: {"noise":138.38487,"time":1681656355764,"from":"localhost"}
⚡️avg=104.121357
sfn received 58 bytes: {"noise":46.46564,"time":1681656355865,"from":"localhost"}
⚡️avg=89.707427
sfn received 59 bytes: {"noise":188.09396,"time":1681656355966,"from":"localhost"}
⚡️avg=109.384734
sfn received 58 bytes: {"noise":93.66026,"time":1681656356067,"from":"localhost"}
⚡️avg=106.763988
sfn received 59 bytes: {"noise":136.37762,"time":1681656356168,"from":"localhost"}
⚡️avg=110.994507
^C
The source code of this example can be found at Github (opens in a new tab)
If you want to craft this demo by yourself, you can start your own Zipper Service by yomo serve and implement your own Source.