From 5b297fb4921d3077c8f498a1d923e8d289238a1c Mon Sep 17 00:00:00 2001 From: Ryan Sweet Date: Fri, 17 Jan 2025 15:44:36 -0800 Subject: [PATCH] back off of aspnet --- dotnet/src/Microsoft.AutoGen/Core.Grpc/App.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dotnet/src/Microsoft.AutoGen/Core.Grpc/App.cs b/dotnet/src/Microsoft.AutoGen/Core.Grpc/App.cs index 5d72bc5eda5e..5a38b0f3c4af 100644 --- a/dotnet/src/Microsoft.AutoGen/Core.Grpc/App.cs +++ b/dotnet/src/Microsoft.AutoGen/Core.Grpc/App.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Google.Protobuf; -using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; @@ -13,25 +12,24 @@ namespace Microsoft.AutoGen.Core.Grpc; public static class AgentsApp { // need a variable to store the runtime instance - public static WebApplication? Host { get; private set; } + public static IHost? Host { get; private set; } [MemberNotNull(nameof(Host))] - public static async ValueTask StartAsync(WebApplicationBuilder? builder = null, AgentTypes? agentTypes = null, bool local = false) + public static async ValueTask StartAsync(HostApplicationBuilder? builder = null, AgentTypes? agentTypes = null, bool local = false) { - builder ??= WebApplication.CreateBuilder(); + builder ??= new HostApplicationBuilder(); builder.Services.TryAddSingleton(DistributedContextPropagator.Current); builder.AddGrpcAgentWorker() .AddAgents(agentTypes); - builder.AddServiceDefaults(); var app = builder.Build(); Host = app; await app.StartAsync().ConfigureAwait(false); return Host; } - public static async ValueTask PublishMessageAsync( + public static async ValueTask PublishMessageAsync( string topic, IMessage message, - WebApplicationBuilder? builder = null, + HostApplicationBuilder? builder = null, AgentTypes? agents = null, bool local = false) {