public async Task <ReturnType> InvokeWithRetry <ReturnType>(string methodName, object[] args) { Func <Task <ReturnType> > retryCall = () => { return(Impromptu.InvokeMember(wrappedObject, methodName, args)); }; var retryInterceptor = new RetryInterceptor <ReturnType>(context, retryOptions, retryCall); return(await retryInterceptor.Invoke()); }
/// <summary> /// Create a suborchestration of the specified name and version. Also retry on failure as per supplied policy. /// </summary> /// <typeparam name="T">Return Type of the TaskOrchestration.RunTask method</typeparam> /// <param name="name">Name of the orchestration as specified by the ObjectCreator</param> /// <param name="version">Name of the orchestration as specified by the ObjectCreator</param> /// <param name="retryOptions">Retry policy</param> /// <param name="input">Input for the TaskOrchestration.RunTask method</param> /// <returns>Task that represents the execution of the specified suborchestration</returns> public virtual Task <T> CreateSubOrchestrationInstanceWithRetry <T>(string name, string version, RetryOptions retryOptions, object input) { Func <Task <T> > retryCall = () => { return(CreateSubOrchestrationInstance <T>(name, version, input)); }; var retryInterceptor = new RetryInterceptor <T>(this, retryOptions, retryCall); return(retryInterceptor.Invoke()); }
/// <summary> /// Schedule a TaskActivity by name and version. Also retry on failure as per supplied policy. /// </summary> /// <typeparam name="T">Return Type of the TaskActivity.Exeute method</typeparam> /// <param name="name">Name of the orchestration as specified by the ObjectCreator</param> /// <param name="version">Name of the orchestration as specified by the ObjectCreator</param> /// <param name="retryOptions">Retry policy</param> /// <param name="parameters">Parameters for the TaskActivity.Execute method</param> /// <returns>Task that represents the execution of the specified TaskActivity</returns> public virtual Task <T> ScheduleWithRetry <T>(string name, string version, RetryOptions retryOptions, params object[] parameters) { Func <Task <T> > retryCall = () => { return(ScheduleTask <T>(name, version, parameters)); }; var retryInterceptor = new RetryInterceptor <T>(this, retryOptions, retryCall); return(retryInterceptor.Invoke()); }