Skip to content

Add .NET Aspire sample with Azurite for local Azure Storage development#546

Open
Aaronontheweb wants to merge 3 commits intopetabridge:devfrom
Aaronontheweb:feature/aspire-sample
Open

Add .NET Aspire sample with Azurite for local Azure Storage development#546
Aaronontheweb wants to merge 3 commits intopetabridge:devfrom
Aaronontheweb:feature/aspire-sample

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Member

Summary

Adds a complete .NET Aspire sample demonstrating how to use Akka.Persistence.Azure with Azurite for local development. This sample was created to investigate a user-reported bug where blob storage was incorrectly connecting to devstoreaccount1.blob.core.windows.net instead of the local Azurite emulator.

What's Included

  • Aspire AppHost project - Orchestrates Azurite container with blob and table storage endpoints
  • Sample console app - Demonstrates a ReceivePersistentActor with both journal (table) and snapshot (blob) persistence
  • README - Documents how to run the sample and explains the Aspire integration

Key Technical Details

  • Aspire Version: 9.1.0
  • Target Framework: net8.0
  • Azurite Configuration: Uses AddAzureStorage("storage").RunAsEmulator() with .AddBlobs() and .AddTables()
  • Connection String Pattern: Aspire provides connection strings with explicit BlobEndpoint= and TableEndpoint= URLs

Testing Results

The reported bug did NOT reproduce - when using Aspire's connection strings (which include explicit endpoint URLs), both blob and table storage connect correctly to the local Azurite emulator.

Files Added

File Description
src/samples/Aspire/README.md Documentation for running the sample
src/samples/Aspire/.../AppHost/ Aspire orchestration project
src/samples/Aspire/.../Sample.Aspire/ Sample console app with CounterActor

Files Modified

File Change
Akka.Persistence.Azure.sln Added Aspire projects under Samples/Aspire folder
src/Directory.Packages.props Added Aspire 9.1 packages

All sample projects have <IsPackable>false</IsPackable> so they won't be published as NuGet packages.

- Add Aspire AppHost project that orchestrates Azurite emulator
- Add sample Akka.NET app with persistent CounterActor demonstrating
  both journal (Table Storage) and snapshot store (Blob Storage)
- Add README with usage instructions and architecture overview
- Add MCP configuration files for AI assistant integration
- Add Aspire 9.1 package versions to central package management
- Update Microsoft.Extensions.Hosting to 8.0.1 for Host.CreateApplicationBuilder support
<ItemGroup>
<PackageVersion Include="Akka.Hosting.TestKit" Version="$(AkkaHostingVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for Aspire

Based on user feedback, using separate WithAzureTableJournal() and
WithAzureBlobsSnapshotStore() calls with endpoint-specific connection
strings from Aspire is the recommended pattern. This ensures each
persistence component uses its correct endpoint URL.

Updated README to explain why WithAzurePersistence() with a single
connection string may not work correctly with Aspire's endpoint-specific
connection strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant