Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 3.48 KB

README.md

File metadata and controls

67 lines (48 loc) · 3.48 KB

Temporal .NET SDK Samples

This is the set of .NET samples for the .NET SDK.

Usage

Prerequisites:

Samples

  • ActivityHeartbeatingCancellation - How to use heartbeating and cancellation handling in an activity.
  • ActivitySimple - Simple workflow that runs simple activities.
  • ActivityWorker - Use .NET activities from a workflow in another language.
  • AspNet - Demonstration of a generic host worker and an ASP.NET workflow starter.
  • Bedrock - Orchestrate a chatbot with Amazon Bedrock.
  • ClientMtls - How to use client certificate authentication, e.g. for Temporal Cloud.
  • ContextPropagation - Context propagation via interceptors.
  • CounterInterceptor - Simple Workflow and Client Interceptors example.
  • DependencyInjection - How to inject dependencies in activities and use generic hosts for workers
  • Encryption - End-to-end encryption with Temporal payload codecs.
  • Mutex - How to implement a mutex as a workflow. Demonstrates how to avoid race conditions or parallel mutually exclusive operations on the same resource.
  • OpenTelemetry - Demonstrates how to set up OpenTelemetry tracing and metrics for both the client and worker, using both the .NET metrics API and internal forwarding from the Core SDK.
  • Patching - Alter workflows safely with Patch and DeprecatePatch.
  • Polling - Recommended implementation of an activity that needs to periodically poll an external resource waiting its successful completion.
  • SafeMessageHandlers - Use Semaphore to ensure operations are atomically processed in a workflow.
  • Saga - Demonstrates how to implement a saga pattern.
  • Schedules - How to schedule workflows to be run at specific times in the future.
  • SignalsQueries - A loyalty program using Signals and Queries.
  • Timer - Use a timer to implement a monthly subscription; handle workflow cancellation.
  • WorkerSpecificTaskQueues - Use a unique task queue per Worker to have certain Activities only run on that specific Worker.
  • WorkerVersioning - How to use the Worker Versioning feature to more easily deploy changes to Workflow & other code.
  • WorkflowUpdate - How to use the Workflow Update feature while blocking in update method for concurrent updates.

Development

Code formatting

This project uses StyleCop analyzers with some overrides in .editorconfig. To format, run:

dotnet format

Can also run with --verify-no-changes to ensure it is formatted.

VisualStudio Code

When developing in vscode, the following JSON settings will enable StyleCop analyzers:

    "omnisharp.enableEditorConfigSupport": true,
    "omnisharp.enableRoslynAnalyzers": true

Testing

Run:

dotnet test

Can add options like:

  • --logger "console;verbosity=detailed" to show logs
  • --filter "FullyQualifiedName=TemporalioSamples.Tests.ActivityWorker.ActivityWorkerTests.Main_RunActivity_Succeeds" to run a specific test