Skip to content

Commit

Permalink
pull up the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet committed Oct 2, 2024
1 parent 9ba14ee commit ae326cc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dotnet/samples/Hello/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
using Microsoft.Extensions.Hosting;
using Microsoft.AutoGen.Agents.Abstractions;
using Microsoft.AutoGen.Agents.Client;
using Microsoft.AutoGen.Agents.Runtime;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = Host.CreateApplicationBuilder(args);
builder.AddAgentService();
builder.Services.AddHostedService<AgentWorkerRuntime>();
builder.Services.AddSingleton<AgentClient>();
builder.UseOrleans(siloBuilder =>
{
siloBuilder.UseLocalhostClustering(); ;
});
builder.AddAgentWorker("https://localhost:5000");
var app = builder.Build();
await app.StartAsync();
AgentClient client = app.Services.GetRequiredService<AgentClient>();
app.Services.GetRequiredService<AgentWorkerRuntime>();
//send our hello message event via cloud events
var evt = new NewMessageReceived
{
Message = "World"
}.ToCloudEvent("HelloAgents");

await client.PublishEventAsync(evt);
await app.WaitForShutdownAsync();

[TopicSubscription("HelloAgents")]
Expand Down Expand Up @@ -59,4 +65,4 @@ public async Task<string> SayHello(string ask)
public interface ISayHello
{
public Task<string> SayHello(string ask);
}
}

0 comments on commit ae326cc

Please sign in to comment.