-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support returning IAsyncObservable<T> from Grain methods #940
Comments
What is wrong with Task? |
Good idea! Some initial thoughts: Silo failures are propagated to observers through OnErrorAsyncOrleans handles silo failures automatically, also such failures doesn't happen too often, and making user handle it would add seemingly unnecessary boilerplate code. Observables can take parameters can you please explain in more detail - what kind of parameters they would take? |
Commenting from phone!!! |
Ufff.... |
@gabikliot: @dVakulen: I mean to say that Grain interfaces can look like this: interface ILocationGrain : IGrainWithGuidKey
{
IAsyncObservable<Deal> FindDeals(SearchFilter filter);
} I can pass some parameter, Another example might be a grain which emits events of different priorities and I only want high-priority events, so I pass that in. Eventually we might be able to return |
So same semantics as Task of IAsyncObs, just different syntax, right? Sure, sounds doable. |
Very similar semantics, yes. One difference is that the Grain method which returns the The implementation could involve a consumer-side proxy representing the grain method invocation used to get the |
LOL. Tell me the truth, are you secretly watching into Orleankka's codebase? 😄 I have this feature implemented already. So that |
Streams can be passable around in Orleans. |
This feature is about extending actor interfaces to support returning streams of values (IAsyncObservable) and would not use the Virtual Streams infrastructure. It's just the logical conclusion of actor interfaces that if I can return a single value asynchronously, I should be able to return multiple values, too. -----Original Message----- Streams can be passable around in Orleans. IAsyncStream should be passable. If not, it's a bug. As I understood, Reuben asks for something else. |
Understood. Like temporary channels? Isn't is what observers were for? |
+1 Nice idea @ReubenBond
I am currently working on another project that would greatly benefit from having this feature available in Orleans too. |
Just to be clear again: we can, now, without any changes, return from the grain method @ReubenBond is asking for more. As I understood, he is asking for syntactic sugar of returning |
@gabikliot just to be clear: returning |
Well, currently, we have only one implementation of the We do actually need to create a test and check it. It "should" work, as it was designed this way, but I don't remember having a test for that, so it is possible there is some field we don't serialize properly or don't reconstruct properly when deserializing. |
I want to be able to return physical streams: streams which will break when the grain is deactivated, forcing the user to resubscribe in order to continue receiving values. For example, I might want to return results to a search query from the grain. Eg, imagine I have an More generally when Bonsai is released, I want methods which take an expression, apply it to a stream (eg, traffic reports), and return the resulting stream. Does that sound like desirable functionality to you? |
Yes, it does. I thought quite a lot about a similar scenario, recently and also originally, when we just started thinking about streams. I will open a new issue and describe my thoughts on that, but a bit later (give me a day or two). |
@ReubenBond It sounds like this idea is to Timers what Virtual Streams are to Reminders. We need both durable and non-durable versions of each of these core concepts. A grain instance stream sounds very useful, in addition to the grain streams currently supported. |
This is a feature request. I may implement it, but I am looking for input before I make an attempt.
Currently, Grains can return
Task
&Task<T>
to consumers. This represents the asynchronous nature of distributed systems programming well and encapsulates the possibility of failure.Task<T>
is restricted to returning only a single value, though.Ideally, Grains should be able to return
IObservable<T>
orIAsyncObservable<T>
(depending on whether or not back-pressure/ack is required) in addition toTask
&Task<T>
.This differs from the Virtual Streams offered by Orleans in a few ways:
(type, key)
.Semantics:
SubscribeAsync
, not when the client obtains theIAsyncObservable<T>
.OnErrorAsync
. Clients can at that point re-SubscribeAsync
, at which point the grain method is invoked again.Any obvious issues which aren't covered here?
Input is be greatly appreciated :)
The text was updated successfully, but these errors were encountered: