Giter Club home page Giter Club logo

swtemporal's Introduction

Serverless Workflow Demo - Temporal execution

This demo shows the integration of Serverless Workflow with Temporal

It also shows the Serverless Workflow project experience, where you can easily build an online editor, visualization, form-based workflow data inputs and ability to start workflow execution and wait for results.

Note: this is a demo and not intended for production use. The demo integration does not support 100% of the Serverless Workflow specification, but the intent is that it does soon.

Note: Serverless Workflow specification supports standards-based function executions, meaning it supports standards such as OpenApi, AsyncApi, GraphQL, etc. For the integration SW functions align to invocations of Temporal Activities. Temporal activities are functions where you can add your own code. For this demo we did not implement (yet) actual invocation of 3rd party services. Currently activities just simulate that work but irl that code can be auto-generated using generators from for example OpenApi service definitions.

About

Demo uses the Temporal Java SDK to define a dynamic workflow capable of executing instructions defined in the Serverless Workflow DSL. For that it uses the Serverless Workflow Java SDK for validating and parsing the JSON (or yaml can be used too) DSL into an object model before interpreting it.

Note that the same type of demo can be produced for Golang - Temporal Go SDK, Serverless Workflow Go SDK TypeScript - Temporal Typescript SDK, Serverless Workflow TypeScript SDK

If you would like to help with this one, or the other mentioned integrations let me know.

This demo runs on Quarkus.

This demo is a work in progress and will be improved over time. The integration can definitely be improved, especially on the passing data between the UI, Quarkus app and Temporal.

Start the demo app

1. Start Temporal Server on Docker

git clone https://github.com/temporalio/docker-compose.git
cd  docker-compose
docker-compose -f docker-compose-cas-es.yml up

2. Start the demo app (Quarkus dev mode)

mvn clean install quarkus:dev

Interact with the demo

1. Access the demo

http://localhost:8080

The top-part of the demo shows the Serverless Workflow online editor and the dynamic graphical workflow representation. Note that the graphical generation is done via the Serverless Workflow Typescript SDK and the MermaidJS library.

The editor supports auto-completion and validation using the Serverless Workflow workflow Json Schema definition.

If you make some changes to your workflow press the "Generate workflow diagram" button to re-generate the workflow image to reflect your changes/updates.

2. View/Edit the Customer Application workflow

Check out the Customer Application workflow. Note the "MakeApplicationDecision" switch state, here we use JsonPath (default for Serverless Workflow is jq) to define two conditions (depending on the customers provided age). You can play with the age numbers if you want to see different workflow execution results.

3. Enter workflow data input

Our workflow expects some data inputs, namely the customer information that is used during workflow execution. Scroll down to the bottom part of the page.

Enter customer first and last name, age and some purchase request, for example "purchase a laptop".

Press the "Run Workflow" button to start workflow execution.

4. Check the Temporal Web UI

Check the Temporal Web UI by navigating to:

http://localhost:8088

You will see your "TemporalServerlessWorkflow" workflow was executed completed. You can click on the workflow Run Id link to see execution details.

5. Check the workflow execution results

Back on our app page (localhost:8080)

look at the "Decision (workflow output)" section. You should see the final decision ("Approved" or "Denied"), in the "Decision" text box and the whole workflow out put JSON in the "Workflow Result" textbox.

swtemporal's People

Contributors

tsurdilo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.