continueasnew

command
v1.0.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

Continue-as-new sample

This sample demonstrates three bounded ContinueAsNew scenarios:

  • checkpoint: explicit checkpointed generations with external-event carryover
  • history-limit: MaxHistoryEvents and OnHistoryLimitExceeded compacting a running orchestration without dropping carried business events
  • event-budget: MaxEventsPerTurn consuming a queued batch across bounded service turns without losing or duplicating work

Prerequisites

Set DTS_CONNECTION_STRING to a task hub you can use for samples:

export DTS_CONNECTION_STRING="Endpoint=http://localhost:8080;TaskHub=default;Authentication=None"

Run

Run every scenario:

go run ./samples/continueasnew

Run one or more named scenarios:

go run ./samples/continueasnew checkpoint
go run ./samples/continueasnew history-limit event-budget

Expected result

Each scenario starts real orchestrations, raises real external events, validates fetched outputs/history, and cleans up its own instance IDs. The program prints:

SAMPLE_OK continueasnew

only after selected scenarios validate and cleanup succeeds.

The event-budget scenario queues its input before starting the worker and checks the public history metrics: every turn processes at most one work-item event, and all queued business items must still be returned.

Cleanup

Every scenario creates a unique owned instance ID with dtssample.NewInstanceID, records it before scheduling, calls dtssample.Cleanup before worker shutdown, and does not purge by broad filters.

Documentation

Overview

Command continueasnew demonstrates bounded ContinueAsNew patterns with explicit checkpoints, MaxHistoryEvents compaction, and MaxEventsPerTurn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL