orleans

Microsoft Orleans - grains calling grains


I am looking into Microsoft Orleans. I have setup a cluster in docker, tt is working perfectly. I am trying to read the documentation on message delivery, but I can't seem to find anything on retry. If I have a grain calling a grain, like this:

   public class HelloGrain : Orleans.Grain, IHello
    {
        private readonly ILogger logger;
        private IOtherGrain otherGrain;

        public HelloGrain(ILogger<HelloGrain> logger)
        {
            this.logger = logger;
        }

        public override async Task OnActivateAsync()
        {
             otherGrain = GrainFactory.GetGrain(this.GetPrimaryKeyString());
             await base.OnActivateAsync();
        }

        Task<string> IHello.SayHello(string greeting)
        {
            string otherGrainReturn = await this.otherGrain.MethodAsync();
            return Task.FromResult($"\n Client said: '{greeting}', so HelloGrain says: Hello!");
        }
    }

Is the string otherGrainReturn = await this.otherGrain.MethodAsync(); getting retried, on failure, somehow? Is it only a timeout that decide when the call fails? Is this to be handled as a basic HTTP call, and should i therefore be retrying myself?

It could be awesome with som link to documentation that say something more on the subject (at-least-once retry etc).


Solution

  • You can see here that by design, Orleans doesn't have any kind of retry policy.

    But you can add it by yourself with a simple try catch block (Or with a specific library like Polly).