dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 475 forks source link

Persistent Kafka getting restarted #6651

Open carlcamilleri opened 1 week ago

carlcamilleri commented 1 week ago

Is there an existing issue for this?

Describe the bug

A Kafka dependency is restarted each time I run the AppHost project.

Minimal reproduction code:


var kafka = builder
    .AddKafka("messaging").WithLifetime(ContainerLifetime.Persistent);

I am on MacOS, using Docker Desktop

Happy to provide further details as necessary

Thank you

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

AppHost CSProj

<Project Sdk="Microsoft.NET.Sdk">
  <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsAspireHost>true</IsAspireHost>
    <UserSecretsId>*****</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>

    <PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
    <PackageReference Include="Aspire.Hosting.Kafka" Version="9.0.0" />
    <PackageReference Include="Aspire.Npgsql" Version="9.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\Domain\Demo\DemoApp\DemoApp.csproj" />
  </ItemGroup>
</Project>

.NET Version info

dotnet --info
.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.4d7d414a

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.4
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.100/

.NET workloads installed:
 Workload version: 8.0.100-manifests.4d7d414a
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: arm64
  Commit:       5535e31a71

.NET SDKs installed:
  8.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  x64   [/usr/local/share/dotnet/x64]
    registered at [/etc/dotnet/install_location_x64]

Environment variables:
  Not set

global.json file:
  Not found

Anything else?

No response