Task Creator Worker
The Task Creator is a simple Pub/Sub consumer that consumes from a configurable subscription.
It checks the validity of the received message and then assembles a cloud task which it then forwards
to the Google Cloud Tasks Service.
If there are any issues with the received messages, the message will be published to a configurable error topic.
Artefacts
The service
-
generates logs in laas-kibana with the name:"me-pubsub-delayer"
-
sends a task with a given delay to the Google Cloud Tasks Service
-
publishes to the configured error topic in case of errors.
The service receives messages to be delayed via a Pub/Sub subscription. The message which shall be delayed must contain the following attributes:
-
me-pubsub-delayer/delay: A string indicating the desired delay. For example: 1d12h, 12000ms, 500s, 1m32s -
me-pubsub-delayer/topic: The topic which shall be used to republish the contained message after the delay.
Queue Configuration
The service supports flexible queue routing through a YAML configuration file. This allows different topics to be routed to different Cloud Task queues based on pattern matching.
Configuration File
The queue mapping configuration is provided via a YAML file that must be mounted as a ConfigMap in Kubernetes.
Default location: /etc/pubsub-delayer/config/queue-mapping.yaml
Configuration Format
# Default queue for topics without specific mapping
default: pubsub-delayer
# Topic-to-queue mappings (evaluated in order, first match wins)
mappings:
# Exact match
client-changes: pubsub-delayer-client-changes
# Pattern matching with wildcards
sending-*: pubsub-delayer-sending-chain
*-dg02: pubsub-delayer-dg02
Pattern Matching Rules
The service uses glob-style pattern matching to route messages:
-
Exact match (highest priority):
client-changesmatches exactlyclient-changes -
Wildcard suffix:
analytics-*matchesanalytics-events,analytics-logs, etc. -
Wildcard prefix:
*-eventsmatchesuser-events,system-events, etc. -
Wildcard middle:
client-*-prodmatchesclient-manager-prod,client-api-prod, etc. -
Default fallback: If no pattern matches, the default queue is used
First match wins: Patterns are evaluated in the order they appear. The first matching pattern determines the queue.
Environment Variables
| Variable | Description |
|---|---|
|
The ID of the GCLOUD project (mandatory) |
|
The GCLOUD private key encoded in Base64 which belongs to the used service account (mandatory) |
|
The email which is used to identify the service account (mandatory). |
|
The email address of the service account used for Cloud Tasks authentication (mandatory). |
|
The pub/sub topic which shall be used to publish erroneous messages. If not specified the default |
|
The subscription which contains the messages for the |
|
The location identifier of the Cloud Task service (default: |
|
Path to the YAML configuration file that defines topic-to-queue mappings (default: |
|
The number of Pub/Sub messages which are allowed to be processed in parallel. If not specified, the default |