Skip to content

Commit

Permalink
starting to fix runtime problems
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet committed Nov 1, 2024
1 parent eb73d1d commit 03762ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions dotnet/src/Microsoft.AutoGen/Abstractions/IAgentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public interface IAgentBase
Task StoreAsync(AgentState state, CancellationToken cancellationToken = default);
Task<T> ReadAsync<T>(AgentId agentId, CancellationToken cancellationToken = default) where T : IMessage, new();
ValueTask PublishEventAsync(CloudEvent item, CancellationToken cancellationToken = default);
ValueTask PublishEventAsync(string topic, IMessage evt, CancellationToken cancellationToken = default);
}
6 changes: 3 additions & 3 deletions dotnet/src/Microsoft.AutoGen/Agents/App.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// App.cs

using Microsoft.AutoGen.Abstractions;
using System.Diagnostics.CodeAnalysis;
using Google.Protobuf;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -46,8 +46,8 @@ public static async ValueTask<WebApplication> PublishMessageAsync(
{
await StartAsync(builder, agents, local);
}
var client = Host.Services.GetRequiredService<AgentBase>() ?? throw new InvalidOperationException("Host not started");
await client.PublishEventAsync(topic, message).ConfigureAwait(false);
var client = Host.Services.GetRequiredService<IAgentBase>() ?? throw new InvalidOperationException("Host not started");
await client.PublishEventAsync(topic, message, new CancellationToken()).ConfigureAwait(false);
return Host;
}
public static async ValueTask ShutdownAsync()
Expand Down

0 comments on commit 03762ae

Please sign in to comment.