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

Consider using IMessage interface on messages. #82

Closed
adamhathcock opened this issue Mar 14, 2017 · 7 comments
Closed

Consider using IMessage interface on messages. #82

adamhathcock opened this issue Mar 14, 2017 · 7 comments

Comments

@adamhathcock
Copy link
Member

To have some complier enforcement, messages should have IMessage or IMessage

This way, you can use the Tell or Request methods and have strongly typed enforcement of messages akin to how MediatR works with its messaging: https://github.com/jbogard/MediatR/wiki

This should have no reflection in the serialized messages, this is purely a C# nice to have.

@rogeralsing
Copy link
Contributor

Proto.Actor allows POCO's to be used for messages in process. only between nodes there is the need for Protobuf.

@adamhathcock
Copy link
Member Author

I guess I mean, I'd like the code to enforce that messages know if there is going to be a reply or not. This way the code at compile time knows if a message should be used on Tell or Request.

It seems requiring messages to have an interface in C# is the best way to do this. I don't think it would affect protobuf though I don't know a lot about it.

@cpx86
Copy link
Contributor

cpx86 commented Mar 14, 2017

I see the value in knowing whether an incoming message is expected to produce a reply or not, but I'm not sure if this is something I think Proto.Actor should be opinionated about. In a lot of applications it probably makes sense, but in some it might not. Also, whether there is going to be a reply or not it not necessarily so straight-forward, e.g. that could depend not only on the type of message, but also on which behavior the receiving actor currently has.

@adamhathcock
Copy link
Member Author

I guess I should write something over proto actor messaging for myself?

I have a CurrentSynchronizationContextDispatcher (I'm using this with WinForms :) ) I can add to extensions or something.

@cpx86
Copy link
Contributor

cpx86 commented Mar 14, 2017

That sounds like a useful thing to have for people who do WinForms :D Maybe we should set up some sort of "contrib" or "extensions" section of the repo for things that are not part of the core library but still nice to have.

@andersarpi
Copy link
Contributor

Forcing an interface on messages I feel could potentially make it harder to setup certain scenarios where you would end up wrapping objects in an IMessage just because you don't want to implement the IMessage interface on them.

@adamhathcock
Copy link
Member Author

Fair enough. I think I'll be starting an extensions library with this and some DI stuff. I can keep it separate or contribute here. I'll share when I have something going.

Thanks!

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

No branches or pull requests

4 participants