-
Notifications
You must be signed in to change notification settings - Fork 76
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
[EXAMPLE] Http-endpoint with WebAPI (C#) #52
Comments
I explored a bit Cedar and had some idea on how to implement this. First I don't like an idea of having a single URL for commands like
or it could be
but with a required header of what kind of command is it and if no id provided it would redirect to newly generated command id via 307 response (like https://eventstore.org/docs/http-api/creating-writing-a-stream/index.html) graintype/commandTypes should not be exactly .net types, but could be annotations or a routing table. this way it should be easier to have 1 to 1 matching of a URI to actor path and HTTP body to actor message. Some things which are fuzzy for me.
|
From my experience, the simplest way to implement such a generic RPC endpoint would be tunneling.
This is easy to bind with Orleans's native method-based interfaces but in our case
This would require some kind of pre-scanning or pre-registering of all known message types. We use special contract binder and mark all of our custom message classes with special attribute (ie P.S. The above could be complemented with
|
So you don't build an inderection layer, but send messages straight to grains if they pass validation? Do you distinguish queries/commands? |
In tunneling (REST0), cmd/queries are not distinguished. It’s all POST with result. It maps to always send messages to actors via Ask. Yes, I do straightforward mapping between routes and actors/messages and then simply use Ask to invoke |
This is just an internal endpoint, of course. We don’t expose actors over http as is. |
it makes more sense then. I was thinking of building something like https://servicestack.net/ routing with security/validation middlewares. Should be a nice exercise at least :) |
Haha, we actually did exactly that in our web api project)) |
Maybe Brighter could be used also. |
Showcase how to dealing with serialization, routing, media types, versioning, etc. See @damianh Cedar.CommandHandling for inspiration
The text was updated successfully, but these errors were encountered: