Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anoopsimon/bank-buddy-temporal-workflow
https://github.com/anoopsimon/bank-buddy-temporal-workflow
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/anoopsimon/bank-buddy-temporal-workflow
- Owner: anoopsimon
- Created: 2024-11-04T09:13:07.000Z (12 days ago)
- Default Branch: master
- Last Pushed: 2024-11-04T10:14:50.000Z (12 days ago)
- Last Synced: 2024-11-04T11:20:38.436Z (12 days ago)
- Language: Go
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Temporal
# Temporal Customer Creation Workflow
This project demonstrates a simple Temporal workflow to simulate customer creation tasks in a bank. The workflow includes multiple activities that represent common post-creation processes, such as account initialization and welcome package delivery.
## Tech Stack
| Tool | Description |
|----------------------------------------------------------------------|----------------------------------------------------|
| | Programming Language |
| | Containerization Platform |
| | Tool for defining and running multi-container applications |
| | Workflow Orchestration Tool |
| | BDD Testing Framework |
| | Matcher library for Go tests |## Prerequisites
Before running the project, make sure you have the following installed:
- **Go** (version 1.17 or higher): [Download Go](https://golang.org/dl/)
- **Docker**: [Download Docker](https://www.docker.com/get-started)
- **Docker Compose**: Typically included with Docker Desktop. Verify installation by running `docker-compose --version`.
- **Make**: Optional: If you want to run infra and tests without using docker commands . Install from internet and run command to verify. `make --version`.## Setting Up Temporal with Docker Compose
To spin up a Temporal server and UI using Docker Compose, use the following setup:
1. Start Temporal services with:
```bash
docker-compose up --build -d
# Alternatively use make command
make infra.start
```
Following services will be running in inside the container
```js
[+] Running 6/6
✔ Container temporal-elasticsearch Running 0.0s
✔ Container temporal-postgresql Running 0.0s
✔ Container temporal Running 3.8s
✔ Container temporal-worker Running 0.4s
✔ Container temporal-admin-tools Running 1.5s
✔ Container temporal-ui Running
```3. Access the Temporal UI by navigating to [Temporal UI](http://localhost:8080) in your web browser.
## Scope of the Temporal Workflow
The `CustomerCreationWorkflow` workflow performs the following activities as part of the customer creation process:
1. **InitializeAccountActivity**: Initializes the customer's account with basic information.
2. **SendWelcomePackageActivity**: Sends a welcome package to the new customer.
3. **SetUpDirectDepositActivity**: Configures direct deposit for the customer.
4. **ActivateDebitCardActivity**: Activates a debit card linked to the customer's account.These activities are managed in a sequence within the Temporal workflow.
## Test Suite
The project includes a Ginkgo test suite to validate the workflow’s functionality. The test suite is located in the `test/` directory.
### Installing the Ginkgo Tool
To install the Ginkgo CLI tool, run:
```bash
go install github.com/onsi/ginkgo/v2/ginkgo@latest
```### Running Tests
To run the Ginkgo tests, use the following command from the project root:
```bash
ginkgo --json-report=test-results.json test -environment=qa
# or if you are using make command
make test
```Sample output:
```plaintext
PS C:\Users\s4514\dev\go\bank-buddy-temporal-workflowe> ginkgo -r test/
Running Suite: CustomerCreationWorkflow Suite - C:\Users\s4514\dev\go\bank-buddy-temporal-workflow\test
=========================================================================================
Random Seed: 1730705962Will run 1 of 1 specs
2024/11/04 18:40:36 INFO No logger configured for temporal client. Created default one.
+Ran 1 of 1 Specs in 0.811 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
PASSGinkgo ran 1 suite in 1m14.8897583s
Test Suite Passed
```This verifies that the `CustomerCreationWorkflow` executes successfully and completes all activities as expected.
### Temporal workflow screenshot
![Temporal Workflow](doc/img/workflow_scr.png)### Containers
![Temporal Workflow](doc/img/containers.png)