EnvelopeFlow.Campaigns 0.1.0-alpha.3.1

This is a prerelease version of EnvelopeFlow.Campaigns.
dotnet add package EnvelopeFlow.Campaigns --version 0.1.0-alpha.3.1
                    
NuGet\Install-Package EnvelopeFlow.Campaigns -Version 0.1.0-alpha.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EnvelopeFlow.Campaigns" Version="0.1.0-alpha.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EnvelopeFlow.Campaigns" Version="0.1.0-alpha.3.1" />
                    
Directory.Packages.props
<PackageReference Include="EnvelopeFlow.Campaigns" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EnvelopeFlow.Campaigns --version 0.1.0-alpha.3.1
                    
#r "nuget: EnvelopeFlow.Campaigns, 0.1.0-alpha.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EnvelopeFlow.Campaigns@0.1.0-alpha.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EnvelopeFlow.Campaigns&version=0.1.0-alpha.3.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=EnvelopeFlow.Campaigns&version=0.1.0-alpha.3.1&prerelease
                    
Install as a Cake Tool

EnvelopeFlow.Campaigns

Descendant trigger routing is the optional IWorkflowChildTriggerStore capability implemented by the supplied orchestration adapters. Existing ICampaignOrchestrationStore implementations keep their original required contract and can continue running ordinary workflows.

Campaigns consume frozen audience pages and admit one recipient at a time with stable deduplication keys. Replace ICampaignStore and ICampaignSink; the sink must atomically deduplicate concurrent and repeated admission. A short mutation freezes the exact submission and reserves quota, then releases its storage ownership before invoking the bounded sink. A second mutation checks the campaign lease, offset and attempt identity before advancing. A crash after sink acceptance safely replays the persisted request. Cancel takes effect once its store operation returns; admissions already in progress may finish, but cannot restore a cancelled checkpoint. Metadata persists without copying audience users. Durable campaigns require durable audience snapshots and a durable sink. The in-memory store is ephemeral. Bulk and transactional semaphores reserve independent capacity.

CampaignRunner uses bounded bulk slots and pages of 1–1000 recipients. Share its TrafficCapacity with host transactional processing to retain reserved capacity. Per-scope/provider minute quotas include accepted admissions and outstanding or uncertain reservations. A sink returning false confirms no admission: its reservation is refunded, while the frozen request survives for retry. Exceptions, cancellation and lost acknowledgements retain the reservation; recovery uses it once, including across minute rollover. A cancelled or stale callback may conservatively retain capacity until historical bucket retention. Final provider rate limits/retry-after remain the transport dispatcher's responsibility. Pause/cancel/resume requires the current revision. The PostgreSQL adapter uses database time for active lease/expiry fences; the in-memory adapter uses the supplied development clock plus elapsed callback time. Selecting durable campaign state while leaving audience snapshots in memory does not provide restart-safe fan-out.

IDueCampaignStore independently adds bounded due claims. RunDueAsync advances known due claims without a host-maintained ID list; successful partial batches yield a one-second discovery turn and quota/sink refusals persist a retry floor. Explicit-ID RunBatchAsync stays compatible. Optional EnvelopeFlow.Campaigns.Hosting supplies a host loop without changing delivery hosting.

ICampaignOrchestrationStore adds bounded recurring schedules and workflow instances. The memory adapter is process-local and globally capped at 1,000 records by default; PostgreSQL uses indexed per-record documents and a 1,000-record full-scope default capacity. Both keep identity tombstones after explicit terminal content redaction, so capacity must be planned rather than silently recycling admission IDs. Records are at most 1 MiB of canonical JSON. Workflow creation reserves the bytes required by every possible embedded child snapshot, frozen definition copy, transition history and bounded ownership/callback metadata before admitting the identity. Root and descendant trigger writes preserve that reservation and return Capacity when a new receipt would consume progress space, even below the separate 256-receipt limit. A refused creation or receipt leaves identity, revision and existing receipts unchanged. Custom adapters must serialize mutations, atomically update document/due index, enforce scope and sample trusted time after ownership.

Recurrence supports fixed intervals (one second–30 days), daily local time, selected weekly weekdays and monthly days 1–31, with a one-year schedule horizon. Weekly/monthly definitions explicitly supply Calendar; monthly missing days either skip that month or use its last day. Monthly NthWeekday instead selects occurrences 1–5 or -1 (last), with a missing fifth skipped. Optional BusinessCalendar supplies working weekdays and at most 366 unique local holiday/exclusion dates; it skips a closed date or shifts to the next/previous working date within 31 days. Applications own holiday lists and revisions. Adjusted duplicate instants produce one occurrence, and adjustments cannot introduce work before StartsAtUtc. Calendar discovery examines at most 800 nominal local dates, bounding long exclusion periods without replaying historical occurrences. Local DST gaps advance to their exact end; overlaps select the earlier UTC occurrence once per date. Skip allows a one-second scheduler tolerance; bounded catch-up defaults to ten occurrences and a one-day maximum age. Catch-up-limit/age skips advance directly to a future nominal and record a skip disposition count (not an estimate of every missed tick). Occurrence lifetime is bounded to 30 days. A pending intent precedes audience resolution; the first persisted snapshot is frozen before stable-key campaign creation. A crash before snapshot checkpoint may leave an unused audience snapshot for explicit audience retention. UpdateScheduleAsync requires a never-used definition revision, CAS and no pending/live leased occurrence; at most 128 revision identities are retained, and historical campaign identities remain unchanged. Cancelling a schedule stops future occurrences, not campaigns already created.

Workflows freeze a forward-only graph of 1–128 notification, delay, trigger or condition steps and expire within one year. Waits last 100 ms–30 days. Notifications carry the exact immutable DeliveryTarget; render/prepare before creating the instance. Conditions are side-effect-free callbacks: they can repeat before commit, while a committed decision never reevaluates. Triggers arriving early are retained in trusted receipt order and the first matching unconsumed trigger wins; a duplicate event/key reuses its receipt, conflicting reuse refuses. At most 256 trigger receipts are retained per instance, with explicit Capacity refusal and no implicit receipt deletion. Paused instances may retain triggers but cannot progress. Trigger timeout uses the Otherwise edge; delay completion uses Next; -1 terminates. Cancellation and expiry stop progression; optional WorkflowSubmissionGuard additionally prevents queued submissions, without retracting in-flight work.

Parallel steps freeze two to eight Branches; Subworkflow freezes one child definition. Each branch follows its own forward-only graph, waits and condition/outcome decisions. The parent follows Next only when every child completes. At most 128 aggregate definition steps and four nested child levels are allowed. Each advancement attempt permits eight concurrent cooperative callback operations across all nested branches; this is not a process-wide quota for host tasks that ignore cancellation. Child snapshots and deterministic identities commit inside the root's existing document before callbacks begin; the root lease/revision fences their atomic checkpoint. A partial concurrent admission followed by failure safely repeats exact child bytes/keys. Children share the root owner, scope and expiry. Root pause, cancellation and expiry fence every descendant; child status describes its last checkpoint rather than creating independent control authority. TriggerChildAsync explicitly routes a receipt to a persisted descendant ID returned by Children; root TriggerAsync targets only the root. Triggers may arrive while paused and invalidate in-flight root claims. Completed child snapshots remain for admitted-message checks and audit until root redaction. Use admission/binding RootInstanceId when extracting child WorkflowSubmissionContext; the guard loads the root then checks the exact descendant identity/revision/target. Nested delivery waits use the same outcome runner/store. These optional JSON fields are omitted for existing definitions and snapshots; no migration or fingerprint rewrite is required.

Campaign creation, notification admission and condition callbacks execute outside storage locks and pooled connections. A persisted callback identity and short attempt lease precede I/O; the checkpoint rechecks the original revision, lease, status and attempt. Callbacks must honor cancellation and perform bounded work. Admission sinks perform durable idempotent admission, never provider I/O. Campaign creation and workflow admission may commit in an unrelated store before checkpoint: recovery reuses frozen bytes/keys. A noncooperative callback may outlive its ten-second wait or overlap recovery; stable idempotency and submission guards remain required. Conditions remain side-effect-free and may reevaluate after an uncommitted decision. Pending occurrence evidence blocks terminal redaction. Durable record/history retention is separate from delivery uncertainty and application-owned scheduling. See the recovery sample.

Triggers and pause/resume can invalidate a claim while its callback is still running. Discovery then waits only until the persisted attempt deadline, bounded by entity expiry; it does not reserve a new full claim lease behind that callback. Repeated advancement of the original live claim leaves its ownership intact.

Child callback results commit using the root transaction's fresh trusted clock. Following delay, trigger and delivery-outcome waits begin at that checkpoint; their timeouts do not include the preceding callback's duration. Already-persisted notification admission times and keys remain frozen on replay. An outcome read's earlier start clock remains separate, so a negative snapshot begun before its deadline cannot commit a timeout after crossing it. Terminal redaction discovery excludes protected pending occurrences before its candidate limit, and rechecks eligibility under storage ownership; those retained records cannot block later eligible records in the same scope.

Optional WorkflowOutcomeRunner selects IWorkflowOutcomeAdvancer plus a separate IWorkflowOutcomeStore. A DeliveryOutcome step references a dominating earlier notification and waits 100 ms–30 days for Accepted, Delivered or Read, then follows Next; permanent rejection/cancellation/expiry or timeout follows Otherwise. Acceptance alone does not prove delivery. Actual durable delivery-outbox events record monotonic evidence, deduplicated by event ID with conflicting reuse refused. Unknown waits until evidence or timeout; retry-scheduled Pending is not permanent rejection. Evidence dated after the wait deadline cannot change a committed timeout. Existing graphs, runner constructors and serialized fingerprints remain compatible when the new optional settings are absent.

Outcome reads complete before taking the orchestration transaction; the checkpoint rechecks its exact owner/definition/target/step context plus the current revision/lease/status. A short no-write orchestration-clock sample precedes the read; timeout may commit only from a snapshot started at/after the wait deadline. A predeadline negative snapshot that crosses the deadline requeues for fresh facts. This avoids nested pool reservations during outcome polling and lets cancellation win while a read is pending. Facts recorded after a read are considered on the next undecided poll; a committed branch/timeout is never reevaluated. Supplied campaign, workflow and outcome adapters can share one bounded data source: external callbacks hold no outer storage connection. Local tests exercise concurrent notification/campaign callbacks with saturated one- and two-connection pools.

WorkflowDeliveryAdmissionSink derives an owner- and root-bound key from the original stable step key, admits exact frozen target bytes, then records the trusted delivery-ID/owner/root/instance/revision/step/target-hash mapping. Step decisions, admissions and outcome facts include the root workflow identity, so an application root ID may equal a generated descendant ID without reusing that descendant's effects. Pass RootInstanceId to IWorkflowOutcomeStore.GetAsync for descendant facts; null selects the requested root instance's own facts. Custom wrappers must forward that context unchanged, and outcome checkpoints reject bindings from a different root. A crash between admission and mapping rolls back the workflow checkpoint; recovery repeats the same admission and completes correlation. WorkflowDeliveryEventHandler refuses unmapped events so the durable outbox retries after recovery. Use it for a dedicated workflow delivery lane, or supply its optional trusted relevance callback for mixed workloads; the callback must recognize workflow messages from independent durable metadata even before correlation exists. Absence of a mapping cannot classify an event as unrelated. Resolve submission guards from the same trusted mapping to fence queued work after cancellation. Custom stores must preserve full-scope atomicity, immutable correlation, monotonic facts, strict stored-field validation and permanent receipt conflict detection. The memory example is process-local. Reference outcome stores retain hash/ID/time metadata with explicit defaults of 1,000 bindings, 10,000 receipts per scope, 1,000 scopes and 16 MiB per scope document; exceeding capacity refuses rather than deleting identity tombstones. Plan explicit namespace retirement/retention outside active workflows; no automatic outcome cleanup job is supplied.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on EnvelopeFlow.Campaigns:

Package Downloads
EnvelopeFlow.Integrations.Policy

Optional live recipient policy guard and campaign admission bridge.

EnvelopeFlow.Campaigns.Hosting

Optional bounded campaign, recurrence and workflow scheduler hosting.

EnvelopeFlow.Experiments.Delivery

Frozen campaign experiment admission, delivery-free holdouts and reporting comparisons.

EnvelopeFlow.Campaigns.Stores.Postgres

Durable PostgreSQL campaign checkpoints, controls, leases and scope quotas.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.3.1 54 11/22/2026
0.1.0-alpha.2.1 78 11/9/2026