Categorygithub.com/swarajkumarsingh/hello-temporal-go
modulepackage
0.0.0-20240414101836-cc33bc644d20
Repository: https://github.com/swarajkumarsingh/hello-temporal-go.git
Documentation: pkg.go.dev

# README

Hello Temporal | Golang Docker

This is a simple project showcasing the integration of Temporal and Golang within a Docker environment. The project consists of a basic "Hello" application that utilizes Temporal for workflow orchestration.

  • Temporal Dashboard Screenshot 2024-01-13 000811

  • Temporal + Go + Docker = Output a

Workflow of temporal

diagram-export-2-16-2024-1_19_28-AM

  • Start the server
  • Define a task(queue) with name
  • Execute a workflow and push it to the queue
  • Start worker.go file(contains all the registration of workflow and activity)
  • Still now the task state is running
  • Now worker.go, starts executing all workflow in the given queue like a queue conusmer
  • And updates the state in temporal dashboard as "completed" or "failed" according to the execution

How the code executes

  • We define the code for the workflow in the project
  • Then we start the temporal, connect to temporal server with the specific queue name
  • Then execute the workflow in the starter
  • Optionally wait for the workflow to complete and give the expected result
  • Then worker.go comes, here again we connect worker to temporal
  • And register all the workflows and activities
  • At last run the worker which then executes Workflow
  • Generally worker is made to run first as, we create workflow and it gets connected in parallel

Prerequisites

Make sure you have the following installed on your system:

  • Docker
  • Go (Golang)
  • Temporal Server (Docker Compose is used in this example)

Getting Started

  1. Clone this repository:

    git clone https://github.com/swarajkumarsingh/hello-temporal-go.git
    cd hello-temporal-go
    
  2. Start the Temporal Server:

    git clone https://github.com/temporalio/docker-compose.git
    cd docker-compose
    docker compose up
    
  3. Run the Worker

    make start_worker
    
  4. Run the Starter

    make start_starter
    

Usage

  • The Hello application will start and execute a simple Temporal workflow, printing "Hello, Temporal!".

Stopping the Environment

To stop the Temporal Server and clean up the environment, run:

docker-compose down

Contributing

If you find any issues or have improvements, feel free to open an issue or submit a pull request. Contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
Workflow is a Hello World workflow definition.