Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET combine Handle and CallHandler #4386

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

.NET combine Handle and CallHandler #4386

wants to merge 15 commits into from

Conversation

LittleLittleCloud
Copy link
Collaborator

Why are these changes needed?

Related issue number

fix #4354

Checks

@LittleLittleCloud LittleLittleCloud changed the title .NET combine Handle and CallObject .NET combine Handle and CallHandler Nov 26, 2024
Copy link
Collaborator

@rysweet rysweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I posted these comments a while back and today while using gh pr from cli I realized that they didn't post fully (submit review) - they were still "pending". anyway I think this is all supplanted by the new PRs

Task<RpcResponse> HandleRequest(RpcRequest request);
void ReceiveMessage(Message message);
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is used in other places (eg App.cs) why remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IAgentBase is already deleted by recent PR. So this change no longer apply.

Anyway, the idea of moving the overloaded PublishEventAsync as an extension method is to simplify the interface definition

}
var payload = item.ProtoData.Unpack(EventTypes.TypeRegistry);
var convertedPayload = Convert.ChangeType(payload, EventTypes.Types[item.Type]);
return this.HandleObject(convertedPayload);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand - with this all agents can handle all messages? I don't think that's what you want..... Maybe a quick call to discuss because I'm not understanding it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HandleObject will check if the agent has the right handler to be invoked. If there's no right handler a "Method not found on type {genericInterfaceType.FullName}" will be raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[.NET] Rewire AgentBase.CallHandler to make use of HandleObject
3 participants