-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create readme for event processing - enrichment example
- Loading branch information
Showing
6 changed files
with
128 additions
and
11 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
typescript/patterns-use-cases/async-tasks-parallelize-work/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# Hello world - TypeScript example | ||
# Async Tasks: Parallelizing work | ||
|
||
Sample project configuration of a Restate service using the TypeScript SDK. | ||
This example shows how to use the Restate SDK to **execute a list of tasks in parallel and then gather their result**. | ||
Also known as fan-out, fan-in. | ||
|
||
Have a look at the [TypeScript Quickstart guide](https://docs.restate.dev/get_started/quickstart?sdk=ts) for more information on how to use this project. | ||
The example implements a [worker service](src/worker_service.ts), that takes a task as input. | ||
It then splits the task into subtasks, executes them in parallel, and then gathers the results. | ||
|
||
Restate guarantees and manages the execution of all the subtasks across failures. | ||
You can run this on FaaS infrastructure, like AWS Lambda, and it will scale automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
typescript/patterns-use-cases/event-processing-enrichment/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3' | ||
services: | ||
broker: | ||
image: confluentinc/cp-kafka:7.5.0 | ||
container_name: broker | ||
ports: | ||
- "9092:9092" | ||
- "9101:9101" | ||
environment: | ||
KAFKA_BROKER_ID: 1 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | ||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092 | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | ||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
KAFKA_PROCESS_ROLES: broker,controller | ||
KAFKA_NODE_ID: 1 | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@broker:29093 | ||
KAFKA_LISTENERS: PLAINTEXT://broker:29092,CONTROLLER://broker:29093,PLAINTEXT_HOST://0.0.0.0:9092 | ||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT | ||
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER | ||
KAFKA_LOG_DIRS: /tmp/kraft-combined-logs | ||
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk | ||
|
||
init-kafka: | ||
image: confluentinc/cp-kafka:7.5.0 | ||
depends_on: | ||
- broker | ||
entrypoint: [ '/bin/sh', '-c' ] | ||
command: | | ||
"# blocks until kafka is reachable | ||
kafka-topics --bootstrap-server broker:29092 --list | ||
echo -e 'Creating kafka topics' | ||
kafka-topics --bootstrap-server broker:29092 --create --if-not-exists --topic package-location-updates --replication-factor 1 --partitions 1 | ||
echo -e 'Successfully created the following topics:' | ||
kafka-topics --bootstrap-server broker:29092 --list" |
3 changes: 3 additions & 0 deletions
3
typescript/patterns-use-cases/event-processing-enrichment/restate.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[[ingress.kafka-clusters]] | ||
name = "my-cluster" | ||
brokers = ["PLAINTEXT://localhost:9092"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters