From 027cbc7ba11e4acbcf802fc3f86beda4bdabe956 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:34:58 +0000 Subject: [PATCH 1/5] Initial plan From 77bcd1fdfbf8c284f8db3ca3721613577392f7fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:40:48 +0000 Subject: [PATCH 2/5] Split entity examples into standalone apps with dts-emulator support Co-authored-by: torosent <17064840+torosent@users.noreply.github.com> --- examples/README.md | 133 ++++++++++++++++++ examples/entity-counter/README.md | 66 +++++++++ .../index.ts} | 35 ++++- examples/entity-counter/package.json | 17 +++ examples/entity-orchestration/README.md | 87 ++++++++++++ .../index.ts} | 54 +++++-- examples/entity-orchestration/package.json | 17 +++ examples/hello-world/README.md | 41 +----- 8 files changed, 392 insertions(+), 58 deletions(-) create mode 100644 examples/README.md create mode 100644 examples/entity-counter/README.md rename examples/{hello-world/entity-counter.ts => entity-counter/index.ts} (82%) create mode 100644 examples/entity-counter/package.json create mode 100644 examples/entity-orchestration/README.md rename examples/{hello-world/entity-orchestration.ts => entity-orchestration/index.ts} (88%) create mode 100644 examples/entity-orchestration/package.json diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..403a6a6 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,133 @@ +# Durable Task JavaScript SDK - Examples + +This directory contains examples demonstrating various features of the Durable Task JavaScript SDK. + +## Example Applications + +Each example is a standalone application with its own README and can be run independently. + +### Basic Orchestration Examples + +Located in `hello-world/`: + +- **[Activity Sequence](./hello-world/activity-sequence.ts)**: Basic orchestration that calls three activities in sequence. +- **[Fan-out/Fan-in](./hello-world/fanout-fanin.ts)**: Orchestration that schedules multiple activities in parallel and aggregates results. +- **[Human Interaction](./hello-world/human_interaction.ts)**: Demonstrates waiting for external events in orchestrations. + +### Durable Entities Examples + +Durable Entities are stateful objects with built-in concurrency control: + +- **[Entity Counter](./entity-counter/)**: Simple counter entity demonstrating basic entity operations, signaling, and state management. +- **[Entity Orchestration](./entity-orchestration/)**: Bank transfer scenario using entity locking for atomic cross-entity operations. + +### Azure Integration Examples + +- **[Azure Managed DTS](./azure-managed/)**: Integration with Azure Managed Durable Task Scheduler using Azure authentication. +- **[Azure Managed DTS (Simple)](./azure-managed-dts.ts)**: Simplified version showing Azure DTS connection setup. + +## Prerequisites + +Examples require a Durable Task-compatible backend. Choose one: + +### Option 1: DTS Emulator (Recommended for Testing) + +The DTS Emulator is ideal for local development and testing: + +```bash +docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +``` + +Most standalone examples can run against the emulator using: + +```bash +cd examples/entity-counter +npm run start:emulator +``` + +### Option 2: Local Sidecar + +Install and run locally (requires Go 1.18+): + +```bash +# Install Dapr CLI (includes Durable Task sidecar) +https://docs.dapr.io/getting-started/install-dapr-cli/ + +# Or build from source +git clone https://github.com/microsoft/durabletask-go +cd durabletask-go +go run . start --backend Emulator +``` + +The sidecar runs on `localhost:4001` by default. + +### Option 3: Unofficial Sidecar Docker Image + +For quick local development: + +```bash +docker run \ + --name durabletask-sidecar -d --rm \ + -p 4001:4001 \ + --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' \ + kaibocai/durabletask-sidecar:latest start \ + --backend Emulator +``` + +## Running Examples + +### Standalone Applications (Recommended) + +Standalone applications include `entity-counter` and `entity-orchestration`. Each has its own `package.json`: + +```bash +cd examples/entity-counter +npm run start:emulator # Run against DTS emulator +# OR +npm run start # Run against local sidecar on localhost:4001 +``` + +See individual README files for detailed instructions. + +### Single-File Examples + +Basic orchestration examples in `hello-world/` can be run directly: + +```bash +npm run example ./examples/hello-world/activity-sequence.ts +``` + +## Testing Against DTS Emulator + +All entity examples are designed to work with the DTS emulator: + +1. Start the DTS emulator: + ```bash + docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + ``` + +2. Run the example: + ```bash + cd examples/entity-counter + npm run start:emulator + ``` + +The emulator provides a clean, isolated environment for testing without requiring external dependencies. + +## Azure Managed DTS + +For production scenarios with Azure, see the [Azure Managed DTS example](./azure-managed/) which demonstrates: +- Connection string configuration +- Azure authentication with DefaultAzureCredential +- Environment-based configuration + +## Documentation + +For more information about Durable Task concepts: + +- **Orchestrations**: Workflow definitions that coordinate activities +- **Activities**: Units of work executed by orchestrations +- **Entities**: Stateful actors with automatic concurrency control +- **Entity Locking**: Critical sections for atomic multi-entity operations + +See the main [README](../README.md) for comprehensive documentation. diff --git a/examples/entity-counter/README.md b/examples/entity-counter/README.md new file mode 100644 index 0000000..f50fd8a --- /dev/null +++ b/examples/entity-counter/README.md @@ -0,0 +1,66 @@ +# Entity Counter Example + +This example demonstrates a simple Counter entity using Durable Entities. + +## What are Durable Entities? + +Durable Entities are stateful objects that can be addressed by a unique ID. They process operations one at a time, ensuring consistency without explicit locks. + +## Key Concepts + +This example demonstrates: +- Defining an entity with `TaskEntity` +- Entity operations (add, get, reset) +- Signaling entities from a client (fire-and-forget) +- Getting entity state from a client + +## Prerequisites + +You need a Durable Task-compatible backend. Choose one: + +### Option 1: DTS Emulator (Recommended for testing) + +```bash +docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +``` + +### Option 2: Local Sidecar + +Install and run the [Durable Task Sidecar](https://github.com/microsoft/durabletask-go) or [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) on `localhost:4001`. + +## Running the Example + +### With DTS Emulator + +```bash +npm run start:emulator +``` + +### With Local Sidecar + +```bash +npm run start +``` + +## Expected Output + +``` +Connecting to endpoint: localhost:8080, taskHub: default +Worker started successfully + +--- Signaling entity operations --- +Signaled: add(5) +Signaled: add(3) +Signaled: add(-2) + +--- Getting entity state --- +Counter value: 6 +Last modified: [timestamp] + +--- Resetting counter --- +Signaled: reset() +Counter value after reset: 0 + +--- Cleaning up --- +Worker stopped +``` diff --git a/examples/hello-world/entity-counter.ts b/examples/entity-counter/index.ts similarity index 82% rename from examples/hello-world/entity-counter.ts rename to examples/entity-counter/index.ts index 9e75352..303e49f 100644 --- a/examples/hello-world/entity-counter.ts +++ b/examples/entity-counter/index.ts @@ -12,11 +12,22 @@ * - Entity operations (add, get, reset) * - Signaling entities from a client (fire-and-forget) * - Getting entity state from a client + * + * This example can run against: + * 1. DTS Emulator (default with npm run start:emulator) + * docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + * 2. Local sidecar (npm run start with localhost:4001) */ -import { TaskHubGrpcClient } from "../../packages/durabletask-js/src/client/client"; -import { TaskHubGrpcWorker } from "../../packages/durabletask-js/src/worker/task-hub-grpc-worker"; -import { TaskEntity, EntityInstanceId } from "../../packages/durabletask-js/src/entities"; +import { TaskEntity, EntityInstanceId } from "@microsoft/durabletask-js"; +import { + DurableTaskAzureManagedClientBuilder, + DurableTaskAzureManagedWorkerBuilder, +} from "@microsoft/durabletask-js-azuremanaged"; + +// Read environment variables for DTS emulator or local sidecar +const endpoint = process.env.ENDPOINT || "localhost:4001"; +const taskHub = process.env.TASKHUB || "default"; // ============================================================================ // Step 1: Define the entity state type @@ -79,9 +90,20 @@ class CounterEntity extends TaskEntity { // ============================================================================ (async () => { - const grpcServerAddress = "localhost:4001"; - const client = new TaskHubGrpcClient(grpcServerAddress); - const worker = new TaskHubGrpcWorker(grpcServerAddress); + console.log(`Connecting to endpoint: ${endpoint}, taskHub: ${taskHub}`); + + // Build client and worker for the DTS emulator or local sidecar + const client = new DurableTaskAzureManagedClientBuilder() + .endpoint(endpoint) + .taskHubName(taskHub) + .useGrpc() + .build(); + + const worker = new DurableTaskAzureManagedWorkerBuilder() + .endpoint(endpoint) + .taskHubName(taskHub) + .useGrpc() + .build(); // Register the entity with the worker worker.addNamedEntity("Counter", () => new CounterEntity()); @@ -149,7 +171,6 @@ class CounterEntity extends TaskEntity { console.log("\n--- Cleaning up ---"); await worker.stop(); console.log("Worker stopped"); - } catch (error) { console.error("Error:", error); await worker.stop(); diff --git a/examples/entity-counter/package.json b/examples/entity-counter/package.json new file mode 100644 index 0000000..ee201b0 --- /dev/null +++ b/examples/entity-counter/package.json @@ -0,0 +1,17 @@ +{ + "name": "entity-counter-example", + "version": "1.0.0", + "description": "Example demonstrating Durable Entities with a simple counter", + "private": true, + "scripts": { + "start": "ts-node --swc index.ts", + "start:emulator": "ENDPOINT=localhost:8080 TASKHUB=default ts-node --swc index.ts" + }, + "dependencies": { + "@microsoft/durabletask-js": "workspace:*", + "@microsoft/durabletask-js-azuremanaged": "workspace:*" + }, + "engines": { + "node": ">=22.0.0" + } +} diff --git a/examples/entity-orchestration/README.md b/examples/entity-orchestration/README.md new file mode 100644 index 0000000..8dfa91f --- /dev/null +++ b/examples/entity-orchestration/README.md @@ -0,0 +1,87 @@ +# Entity Orchestration Example + +This example demonstrates using Durable Entities from within orchestrations, including entity locking for atomic operations. + +## What You'll Learn + +This example demonstrates: +- Calling entities from orchestrations (request/response) +- Signaling entities from orchestrations (fire-and-forget) +- Entity locking / Critical sections for atomic operations across multiple entities + +## Scenario + +A bank transfer between two accounts (entities). We use entity locking to ensure the transfer is atomic - both the withdrawal and deposit happen together, or neither happens. + +## Prerequisites + +You need a Durable Task-compatible backend. Choose one: + +### Option 1: DTS Emulator (Recommended for testing) + +```bash +docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +``` + +### Option 2: Local Sidecar + +Install and run the [Durable Task Sidecar](https://github.com/microsoft/durabletask-go) or [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) on `localhost:4001`. + +## Running the Example + +### With DTS Emulator + +```bash +npm run start:emulator +``` + +### With Local Sidecar + +```bash +npm run start +``` + +## Expected Output + +``` +Connecting to endpoint: localhost:8080, taskHub: default +Worker started successfully + +--- Initializing accounts --- +Alice balance: 1000 +Bob balance: 500 + +--- Running transfer orchestration --- +Transfer orchestration started: [instance-id] +In critical section: true +Locked entities: BankAccount@alice, BankAccount@bob +From account balance: 1000 +To account balance: 500 +Transfer completed: {"success":true,"fromBalance":750,"toBalance":750,"message":"Transferred 250 from alice to bob"} + +--- Final balances --- +Alice balance: 750 +Bob balance: 750 + +--- Cleaning up --- +Worker stopped +``` + +## Key Concepts + +### Entity Locking + +Entity locking ensures that multiple entities can be locked together for atomic operations: + +```typescript +const lock: LockHandle = yield* ctx.entities.lockEntities(fromEntity, toEntity); +try { + // Perform atomic operations + yield* ctx.entities.callEntity(fromEntity, "withdraw", amount); + yield* ctx.entities.callEntity(toEntity, "deposit", amount); +} finally { + lock.release(); +} +``` + +This prevents race conditions when multiple orchestrations try to access the same entities concurrently. diff --git a/examples/hello-world/entity-orchestration.ts b/examples/entity-orchestration/index.ts similarity index 88% rename from examples/hello-world/entity-orchestration.ts rename to examples/entity-orchestration/index.ts index 2b364f7..053b52d 100644 --- a/examples/hello-world/entity-orchestration.ts +++ b/examples/entity-orchestration/index.ts @@ -11,13 +11,28 @@ * * Scenario: A bank transfer between two accounts (entities). * We use entity locking to ensure the transfer is atomic. + * + * This example can run against: + * 1. DTS Emulator (default with npm run start:emulator) + * docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + * 2. Local sidecar (npm run start with localhost:4001) */ -import { TaskHubGrpcClient } from "../../packages/durabletask-js/src/client/client"; -import { TaskHubGrpcWorker } from "../../packages/durabletask-js/src/worker/task-hub-grpc-worker"; -import { OrchestrationContext } from "../../packages/durabletask-js/src/task/context/orchestration-context"; -import { TOrchestrator } from "../../packages/durabletask-js/src/types/orchestrator.type"; -import { TaskEntity, EntityInstanceId, LockHandle } from "../../packages/durabletask-js/src/entities"; +import { + TaskEntity, + EntityInstanceId, + LockHandle, + OrchestrationContext, + TOrchestrator, +} from "@microsoft/durabletask-js"; +import { + DurableTaskAzureManagedClientBuilder, + DurableTaskAzureManagedWorkerBuilder, +} from "@microsoft/durabletask-js-azuremanaged"; + +// Read environment variables for DTS emulator or local sidecar +const endpoint = process.env.ENDPOINT || "localhost:4001"; +const taskHub = process.env.TASKHUB || "default"; // ============================================================================ // Step 1: Define the BankAccount entity @@ -125,7 +140,9 @@ const transferOrchestration: TOrchestrator = async function* ( const criticalSectionInfo = ctx.entities.isInCriticalSection(); if (!ctx.isReplaying) { console.log(`In critical section: ${criticalSectionInfo.inSection}`); - console.log(`Locked entities: ${criticalSectionInfo.lockedEntities?.map(e => e.toString()).join(", ")}`); + console.log( + `Locked entities: ${criticalSectionInfo.lockedEntities?.map((e) => e.toString()).join(", ")}`, + ); } // ====================================================================== @@ -157,7 +174,11 @@ const transferOrchestration: TOrchestrator = async function* ( // Perform the transfer (within critical section - atomic!) // ====================================================================== - const newFromBalance: number = yield* ctx.entities.callEntity(fromEntity, "withdraw", input.amount); + const newFromBalance: number = yield* ctx.entities.callEntity( + fromEntity, + "withdraw", + input.amount, + ); const newToBalance: number = yield* ctx.entities.callEntity(toEntity, "deposit", input.amount); return { @@ -166,7 +187,6 @@ const transferOrchestration: TOrchestrator = async function* ( toBalance: newToBalance, message: `Transferred ${input.amount} from ${input.fromAccount} to ${input.toAccount}`, } as TransferResult; - } finally { // ====================================================================== // Release the locks (always, even on error) @@ -210,9 +230,20 @@ const notifyOrchestration: TOrchestrator = async function* ( // ============================================================================ (async () => { - const grpcServerAddress = "localhost:4001"; - const client = new TaskHubGrpcClient(grpcServerAddress); - const worker = new TaskHubGrpcWorker(grpcServerAddress); + console.log(`Connecting to endpoint: ${endpoint}, taskHub: ${taskHub}`); + + // Build client and worker for the DTS emulator or local sidecar + const client = new DurableTaskAzureManagedClientBuilder() + .endpoint(endpoint) + .taskHubName(taskHub) + .useGrpc() + .build(); + + const worker = new DurableTaskAzureManagedWorkerBuilder() + .endpoint(endpoint) + .taskHubName(taskHub) + .useGrpc() + .build(); // Register entity and orchestrations worker.addEntity("BankAccount", () => new BankAccountEntity()); @@ -274,7 +305,6 @@ const notifyOrchestration: TOrchestrator = async function* ( console.log("\n--- Cleaning up ---"); await worker.stop(); console.log("Worker stopped"); - } catch (error) { console.error("Error:", error); await worker.stop(); diff --git a/examples/entity-orchestration/package.json b/examples/entity-orchestration/package.json new file mode 100644 index 0000000..8d82a71 --- /dev/null +++ b/examples/entity-orchestration/package.json @@ -0,0 +1,17 @@ +{ + "name": "entity-orchestration-example", + "version": "1.0.0", + "description": "Example demonstrating Durable Entities with orchestrations and entity locking", + "private": true, + "scripts": { + "start": "ts-node --swc index.ts", + "start:emulator": "ENDPOINT=localhost:8080 TASKHUB=default ts-node --swc index.ts" + }, + "dependencies": { + "@microsoft/durabletask-js": "workspace:*", + "@microsoft/durabletask-js-azuremanaged": "workspace:*" + }, + "engines": { + "node": ">=22.0.0" + } +} diff --git a/examples/hello-world/README.md b/examples/hello-world/README.md index c9a5542..e0c2496 100644 --- a/examples/hello-world/README.md +++ b/examples/hello-world/README.md @@ -23,10 +23,10 @@ All the examples assume that you have a Durable Task-compatible sidecar running ## Running the examples -With one of the sidecars running, you can simply execute any of the examples in this directory using `python3`: +With one of the sidecars running, you can simply execute any of the examples in this directory using `ts-node`: ```sh -npm run example ./examples/activity-sequence.ts +npm run example ./examples/hello-world/activity-sequence.ts ``` In some cases, the sample may require command-line parameters or user inputs. In these cases, the sample will print out instructions on how to proceed. @@ -35,40 +35,3 @@ In some cases, the sample may require command-line parameters or user inputs. In - [Activity sequence](./activity-sequence.ts): Orchestration that schedules three activity calls in a sequence. - [Fan-out/fan-in](./fanout-fanin.ts): Orchestration that schedules a dynamic number of activity calls in parallel, waits for all of them to complete, and then performs an aggregation on the results. -- [Azure Managed DTS](./azure-managed-dts.ts): Demonstrates integration with Azure Managed Durable Task Scheduler (DTS) using the portable SDK with Azure authentication. -- [Entity Counter](./entity-counter.ts): A simple Counter entity demonstrating durable entities - defining entity state, operations, and accessing entities from a client. -- [Entity Orchestration](./entity-orchestration.ts): Demonstrates calling and locking entities from orchestrations, including a bank transfer scenario with atomic cross-entity transactions. - -## Running the Azure Managed DTS example - -The Azure Managed DTS example requires an Azure Durable Task Scheduler endpoint. You can configure it using a `.env` file (recommended) or environment variables. - -### Option 1: Using a .env file (recommended) - -Create a `.env` file in the `examples` directory with your configuration: - -```env -# Using connection string -AZURE_DTS_CONNECTION_STRING=Endpoint=https://myservice.durabletask.io;Authentication=DefaultAzure;TaskHub=myTaskHub - -# Or using explicit parameters (uses DefaultAzureCredential) -# AZURE_DTS_ENDPOINT=https://myservice.durabletask.io -# AZURE_DTS_TASKHUB=myTaskHub -``` - -Then run the example: - -```sh -npm run example ./examples/azure-managed-dts.ts -``` - -> **Note**: The `.env` file is ignored by git to prevent accidental credential exposure. - -### Option 2: Using environment variables directly - -```sh -export AZURE_DTS_CONNECTION_STRING="Endpoint=https://myservice.durabletask.io;Authentication=DefaultAzure;TaskHub=myTaskHub" -npm run example ./examples/azure-managed-dts.ts -``` - -When using explicit parameters (`AZURE_DTS_ENDPOINT` and `AZURE_DTS_TASKHUB`), the example uses `DefaultAzureCredential` for authentication. Make sure you are logged in via Azure CLI (`az login`) or have appropriate credentials configured. From 9a3b458df0efd0421642d7541384d7192a39a51e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:42:26 +0000 Subject: [PATCH 3/5] Add comprehensive testing guide for entity examples Co-authored-by: torosent <17064840+torosent@users.noreply.github.com> --- examples/TESTING.md | 141 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 examples/TESTING.md diff --git a/examples/TESTING.md b/examples/TESTING.md new file mode 100644 index 0000000..92e1ee9 --- /dev/null +++ b/examples/TESTING.md @@ -0,0 +1,141 @@ +# Testing Entity Examples Against DTS Emulator + +This guide explains how to test the entity examples (`entity-counter` and `entity-orchestration`) against the DTS emulator. + +## Prerequisites + +1. Docker installed and running +2. Node.js 22+ installed (as specified in package.json) +3. Dependencies installed: `npm install` in the repository root + +## Step 1: Start the DTS Emulator + +```bash +docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +``` + +Wait a few seconds for the emulator to be ready. + +## Step 2: Test entity-counter Example + +```bash +cd examples/entity-counter +npm run start:emulator +``` + +### Expected Output + +``` +Connecting to endpoint: localhost:8080, taskHub: default +Worker started successfully + +--- Signaling entity operations --- +Signaled: add(5) +Signaled: add(3) +Signaled: add(-2) + +--- Getting entity state --- +Counter value: 6 +Last modified: [timestamp] + +--- Resetting counter --- +Signaled: reset() +Counter value after reset: 0 + +--- Cleaning up --- +Worker stopped +``` + +## Step 3: Test entity-orchestration Example + +```bash +cd examples/entity-orchestration +npm run start:emulator +``` + +### Expected Output + +``` +Connecting to endpoint: localhost:8080, taskHub: default +Worker started successfully + +--- Initializing accounts --- +Alice balance: 1000 +Bob balance: 500 + +--- Running transfer orchestration --- +Transfer orchestration started: [instance-id] +In critical section: true +Locked entities: BankAccount@alice, BankAccount@bob +From account balance: 1000 +To account balance: 500 +Transfer completed: {"success":true,"fromBalance":750,"toBalance":750,"message":"Transferred 250 from alice to bob"} + +--- Final balances --- +Alice balance: 750 +Bob balance: 750 + +--- Cleaning up --- +Worker stopped +``` + +## Step 4: Clean Up + +Stop the DTS emulator: + +```bash +docker stop dts-emulator +``` + +## Alternative: Test Against Local Sidecar + +If you prefer to test against a local sidecar instead of the emulator: + +1. Start the sidecar on `localhost:4001` (using Dapr CLI or durabletask-go) +2. Run the examples with the default start script: + +```bash +cd examples/entity-counter +npm run start +``` + +## Troubleshooting + +### "Cannot find module" errors + +Make sure dependencies are installed: +```bash +cd /path/to/durabletask-js +npm install +``` + +### "ts-node: command not found" + +The `ts-node` package should be installed as a dev dependency. Run `npm install` in the repository root. + +### Emulator connection errors + +- Verify the emulator is running: `docker ps | grep dts-emulator` +- Check logs: `docker logs dts-emulator` +- Ensure port 8080 is not in use by another process + +### Worker fails to start + +Check that the packages are built: +```bash +npm run build +``` + +## Validation Script + +A validation script is available to check the structure: + +```bash +bash /tmp/validate_examples.sh +``` + +This verifies: +- Example directory structure +- package.json scripts +- Environment variable support +- Required imports and builders From 777f2958189494c20d27b4b0173593b822c8d785 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:43:23 +0000 Subject: [PATCH 4/5] Fix docker commands to include container name and --rm flag Co-authored-by: torosent <17064840+torosent@users.noreply.github.com> --- examples/README.md | 2 +- examples/TESTING.md | 2 +- examples/entity-counter/README.md | 2 +- examples/entity-counter/index.ts | 2 +- examples/entity-orchestration/README.md | 2 +- examples/entity-orchestration/index.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/README.md b/examples/README.md index 403a6a6..82e97ef 100644 --- a/examples/README.md +++ b/examples/README.md @@ -35,7 +35,7 @@ Examples require a Durable Task-compatible backend. Choose one: The DTS Emulator is ideal for local development and testing: ```bash -docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest ``` Most standalone examples can run against the emulator using: diff --git a/examples/TESTING.md b/examples/TESTING.md index 92e1ee9..5df267d 100644 --- a/examples/TESTING.md +++ b/examples/TESTING.md @@ -11,7 +11,7 @@ This guide explains how to test the entity examples (`entity-counter` and `entit ## Step 1: Start the DTS Emulator ```bash -docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest ``` Wait a few seconds for the emulator to be ready. diff --git a/examples/entity-counter/README.md b/examples/entity-counter/README.md index f50fd8a..39f0bd8 100644 --- a/examples/entity-counter/README.md +++ b/examples/entity-counter/README.md @@ -21,7 +21,7 @@ You need a Durable Task-compatible backend. Choose one: ### Option 1: DTS Emulator (Recommended for testing) ```bash -docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest ``` ### Option 2: Local Sidecar diff --git a/examples/entity-counter/index.ts b/examples/entity-counter/index.ts index 303e49f..c0cf80e 100644 --- a/examples/entity-counter/index.ts +++ b/examples/entity-counter/index.ts @@ -15,7 +15,7 @@ * * This example can run against: * 1. DTS Emulator (default with npm run start:emulator) - * docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + * docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest * 2. Local sidecar (npm run start with localhost:4001) */ diff --git a/examples/entity-orchestration/README.md b/examples/entity-orchestration/README.md index 8dfa91f..9680450 100644 --- a/examples/entity-orchestration/README.md +++ b/examples/entity-orchestration/README.md @@ -20,7 +20,7 @@ You need a Durable Task-compatible backend. Choose one: ### Option 1: DTS Emulator (Recommended for testing) ```bash -docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest +docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest ``` ### Option 2: Local Sidecar diff --git a/examples/entity-orchestration/index.ts b/examples/entity-orchestration/index.ts index 053b52d..56a667d 100644 --- a/examples/entity-orchestration/index.ts +++ b/examples/entity-orchestration/index.ts @@ -14,7 +14,7 @@ * * This example can run against: * 1. DTS Emulator (default with npm run start:emulator) - * docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + * docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest * 2. Local sidecar (npm run start with localhost:4001) */ From 447fa768e6364c2d9c8b8016bba7238c82593afa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:44:02 +0000 Subject: [PATCH 5/5] Fix remaining docker command in examples README Co-authored-by: torosent <17064840+torosent@users.noreply.github.com> --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 82e97ef..c63bd3a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -103,7 +103,7 @@ All entity examples are designed to work with the DTS emulator: 1. Start the DTS emulator: ```bash - docker run -i -p 8080:8080 -d mcr.microsoft.com/dts/dts-emulator:latest + docker run --name dts-emulator -i -p 8080:8080 -d --rm mcr.microsoft.com/dts/dts-emulator:latest ``` 2. Run the example: