Skip to content

ldmtam/realtimemap-temporal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-time Map

Real-time Map displays real-time positions of public transport vehicles in Helsinki. It's a showcase for using Temporal Workflow as Actors

The app features:

  • Real-time positions of vehicles.
  • Vehicle trails.
  • Geofencing notifications (vehicle entering and exiting the area).
  • Vehicles in geofencing areas per public transport company.
  • Horizontal scaling.

The goals of this app are:

  • Showing what Temporal Workflow can do.
  • Presenting a semi-real-world use case of the distributed actor model.
  • Learning how to use Temporal Workflow

Running the app

Prerequisites:

Run Temporal Workflow

temporal server start-dev

Run Redis

make start-redis

Start worker

go run worker/main.go

Start backend

go run main.go

Check out the Temporal Workflow UI by navigating to localhost:8233

What does it do?

We'll have 3 types of Workflow in the application

  • Vehicle: receive position update message from MQTT, send signal the organization Workflow, maintain vehicle position history and response to get vehicle history request from server
  • Organization: receive signal from vehicle Workflow and send signal to corresponding geofence Workflow
  • Geofence: receive signal from organization Workflow, maintain which vehicles are currently in this geofence and response to get geofence request from server
  • Notification: receive signal from geofence Workflow and publish vehicles ENTER/EXIT geofence area event to Redis

cURL

List all organizations that have geofences setup

curl --location 'localhost:12345/api/v1/organization'

List all geofences and vehicles currently inside those geofences of an organization

curl --location 'localhost:12345/api/v1/organization/0030'

List all position changes history of an vehicle

curl --location 'localhost:12345/api/v1/trail/0012.02212'

You can use Postman to connect to the websocket endpoint at localhost:12345/ws to consume vehicle events entering/exiting geofence area

How does it work?

Please refer to the .NET version using Proto.Actor README for a detailed description of the architecture.

TODO

  • Support Geofencing notifications (vehicle entering and exiting the area).
  • Support Continue-As-New for Workflows when Temporal history events length and size limit reached.

About

A showcase for using Temporal Workflow as Actors

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published