Awesome
Temporal Simple Polyglot example
<p align="center"> <img src="img/polyglot-overview.png" height="500px" alt="App Overview"/> </p>This demo uses the following Temporal SDKs:
It shows how Temporal can act as a service orchestrator and mediator between different distributed applications written in different programming languages.
Interactions between Workflows and Activities:
- Java Workflow signals Go Workflow (10 times)
- Go Workflow signals Java Workflow (10 times)
- Java Workflow invokes a Go Activity
- Go Activity queries Java Workflow
- Go Workflow invokes Java Activity
- Java Activity queries Go Workflow
- Java Workflow signals PHP Workflow (10 times)
- Go Workflow signals PHP Workflow (10 times)
- Java Workflow invokes NodeJS Activity and propagates its error
- Go Workflow invokes NodeJS Activity and propagates its error
- PHP Wokflow invokes NodeJS Activity and propagates its error
Running the demo
- Start the Temporal Server:
git clone https://github.com/temporalio/docker-compose.git
cd docker-compose
docker compose up
Note: The sample apps in different languages should be started in the shown order. They should be started within 3 minutes from each other. You can set different Workflow execution timeouts to change this if you wish.
- Start the Node sample:
cd app-node
npm install
npm start
"npm install" does not have to be run each time, only when changes are made.
- Start the PHP sample:
cd app-php
composer install
./rr serve
php app.php simple
"composer install" does not have to be run each time.
- Start the Go worker and starter:
cd app-go
go run worker/main.go
go run starter/main.go
- Start the Java worker and starter:
cd app-java
mvn compile exec:java -Dexec.mainClass="org.simple.app.StartWorker"
mvn compile exec:java -Dexec.mainClass="org.simple.app.StartWorkflow"
Seeing the results:
- Look at the logs printed in the same window where you ran the Go workflow starter, you should ge:
Workflow result:
Hello from Java Workflow: 0
Hello from Java Workflow: 1
Hello from Java Workflow: 2
Hello from Java Workflow: 3
Hello from Java Workflow: 4
Hello from Java Workflow: 5
Hello from Java Workflow: 6
Hello from Java Workflow: 7
Hello from Java Workflow: 8
Hello from Java Workflow: 9
Java SimpleActivity - hello from: GoWorkflow Query result: This is a simple Go Workflow
Error from Node Activity: NodeJs Activity Error...
- Look at the results of our Java workflow, you should get:
Hello from Go workflow: 0
Hello from Go workflow: 1
Hello from Go workflow: 2
Hello from Go workflow: 3
Hello from Go workflow: 4
Hello from Go workflow: 5
Hello from Go workflow: 6
Hello from Go workflow: 7
Hello from Go workflow: 8
Hello from Go workflow: 9
Go Activity - hello from: JavaWorkflow Query result: This is a simple Java Workflow
Error from Node Activity: NodeJs Activity Error...
- Look at the results of your PHP workflow, you should get:
Result:
Hello from Java Workflow: 0
Hello from Java Workflow: 1
Hello from Java Workflow: 2
Hello from Java Workflow: 3
Hello from Java Workflow: 4
Hello from Java Workflow: 5
Hello from Java Workflow: 6
Hello from Java Workflow: 7
Hello from Java Workflow: 8
Hello from Java Workflow: 9
Hello from Go workflow: 0
Hello from Go workflow: 1
Hello from Go workflow: 2
Hello from Go workflow: 3
Hello from Go workflow: 4
Hello from Go workflow: 5
Hello from Go workflow: 6
Hello from Go workflow: 7
Hello from Go workflow: 8
Hello from Go workflow: 9
Error from Node Activity: NodeJs Activity Error...