Use Protobufs.
- Example proto files:
- Scripts for compiling protos: package.json
- Root file: protos/root.js
- Payload Converter: src/payload-converter.ts
We provide the Payload Converter to the Client (src/client.ts) and Worker (src/worker.ts), and then we can use Protobufs in the Client, Workflow (src/workflows.ts), and Activity (src/activities.ts).
temporal server start-devto start Temporal Server.npm installto install dependencies.npm run start.watchto start the Worker.- In another shell,
npm run workflowto run the Workflow Client.
The client should log the Workflow ID that is started, and you should see it reflected in Temporal Web UI.
Optionally, you can also uncomment the await handle.result(), rerun, and see the client script return:
Started workflow my-business-id-b6155489-920f-41a8-9e88-c17c24d47ee9
{ sentence: 'Proto is 2 years old.' }