Subliminal: Configurable Task Management System

Subliminal is a versatile task management API that enables seamless storage, retrieval, and execution of generic Task objects across a robust microservice architecture built on Google Cloud Platform (GCP). Developed primarily as a learning endeavour, this project showcases a spectrum of advanced technologies, including:

Overview

At its core, Subliminal functions as a comprehensive CRUD (Create, Read, Update, Delete) application, designed to facilitate various operations on Task objects stored within a database. Moreover, it introduces a twist by integrating the capability to dispatch these records to one or more executor services. These executors, whether hosted in the cloud or locally, execute tasks while asynchronously updating the API for seamless datastore reflection.

Project Structure

Subliminal's architecture is built upon the foundation of the subliminal crate, accessible via crates.io. This crate encompasses key utilities necessary for constructing each pivotal service within the broader Subliminal ecosystem:

The architecture's interaction is represented in the following diagram:

mermaid flowchart LR A[API] <--> B[Datastore] A <--> C[Task Message Queue] C --> D[Executor] D --> E((Worker)) D --> F((Worker))

Protobuf File Generation

To enable efficient communication between the API and certain services, Subliminal employs gRPC communication. Base protocol buffers reside in the designated GitHub repository, triggering automated stub generation for Rust using prost through a GitHub action. The subliminal project then pulls the desired sublimina-protos-rust version as a git submodule, enabling seamless service definition implementation.

Datastore (Firestore DB)

The API service interfaces synchronously with the datastore service, functioning similarly to a conventional CRUD application. It offers full CRUD functionality for task request and execution records, leveraging various gRPC definitions. Further insights into record types, database implementation specifics, and instance setup can be found in the subliminal-datstore repository.

Message Queue (Google PubSub)

Although the message queue is not a distinct service within Subliminal, it encapsulates Google's PubSub services to be used throughout the system. It is manifested as a MessageQueue, streamlining the enqueueing of task executions and updates asynchronously. Built using the MessageQueueBuilder, it is pivotal in decoupling the executor from other services.

Execution Nodes

A distinctive feature of Subliminal is its execution nodes, which distinguish it from traditional CRUD applications. These nodes are responsible for dequeuing tasks from the MessageQueue, deserializing them, and executing them based on their parameters. The process involves:

  1. Defining a struct implementing the Task trait.
  2. Implementing the Task trait for the defined struct, detailing the task execution
  3. Using the ExecutionNodeBuilder to construct an execution node with designated consumers.

Consumers continually poll the MessageQueue asynchronously, deserializing data from task requests. The dispatcher distributes tasks to available workers, while workers execute tasks, updating the dispatcher for further processing.