/// <summary> /// Create a proxy client class to schedule remote TaskActivities via a strongly typed interface. /// </summary> /// <typeparam name="T">The interface for the proxy client</typeparam> /// <param name="useFullyQualifiedMethodNames"> /// If true, the method name translation from the interface contains /// the interface name, if false then only the method name is used /// </param> /// <returns></returns> public virtual T CreateClient <T>(bool useFullyQualifiedMethodNames) where T : class { if (!typeof(T).IsInterface) { throw new InvalidOperationException("Pass in an interface."); } var proxy = new ScheduleProxy(this, typeof(T), useFullyQualifiedMethodNames); return(proxy.ActLike <T>()); }
/// <summary> /// Creates a proxy client with built-in retry logic. /// </summary> /// <typeparam name="T"> /// Task version of the client interface. /// This is similar to the actual interface implemented by the client but with the /// return types always of the form Task<TOriginal> /// where TOriginal was the return /// type for the same method in the original interface /// </typeparam> /// <param name="retryOptions">Retry policies</param> /// <param name="useFullyQualifiedMethodNames"> /// If true, the method name translation from the interface contains /// the interface name, if false then only the method name is used /// </param> /// <returns>Dynamic proxy that can be used to schedule the remote tasks</returns> public virtual T CreateRetryableClient <T>(RetryOptions retryOptions, bool useFullyQualifiedMethodNames) where T : class { if (!typeof(T).IsInterface) { throw new InvalidOperationException("Pass in an interface."); } var scheduleProxy = new ScheduleProxy(this, typeof(T), useFullyQualifiedMethodNames); var retryProxy = new RetryProxy <T>(this, retryOptions, scheduleProxy.ActLike <T>()); return(retryProxy.ActLike <T>()); }