Skip to content

Commit

Permalink
add default subscriptions for the agent type - Implicitly created sub…
Browse files Browse the repository at this point in the history
…scription for agent RPC #4321
  • Loading branch information
rysweet committed Nov 22, 2024
1 parent 1e0b254 commit 7d47213
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dotnet/src/Microsoft.AutoGen/Agents/Services/Grpc/GrpcGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ private async ValueTask RegisterAgentTypeAsync(GrpcWorkerConnection connection,
Success = true
}
};
// add a default subscription for the agent type
//TODO: we should consider having constraints on the namespace or at least migrate all our examples to use well typed namesspaces like com.microsoft.autogen/hello/HelloAgents etc
var subscriptionRequest = new AddSubscriptionRequest
{
RequestId = Guid.NewGuid().ToString(),
Subscription = new Subscription
{
TypeSubscription = new TypeSubscription
{
AgentType = msg.Type,
TopicType = msg.Type
}
}
};
await AddSubscriptionAsync(connection, subscriptionRequest).ConfigureAwait(true);

await connection.ResponseStream.WriteAsync(response).ConfigureAwait(false);
}
private async ValueTask DispatchEventAsync(CloudEvent evt)
Expand Down

0 comments on commit 7d47213

Please sign in to comment.