2025-05-27 14:27:50 +08:00
|
|
|
namespace JiShe.IoT.HttpApi.Client.ConsoleTestApp
|
2025-03-11 10:24:11 +08:00
|
|
|
{
|
|
|
|
|
[DependsOn(
|
2025-05-27 14:27:50 +08:00
|
|
|
typeof(IoTHttpApiClientModule),
|
2025-03-11 10:24:11 +08:00
|
|
|
typeof(AbpHttpClientIdentityModelModule)
|
|
|
|
|
)]
|
2025-05-27 14:27:50 +08:00
|
|
|
public class IoTConsoleApiClientModule : AbpModule
|
2025-03-11 10:24:11 +08:00
|
|
|
{
|
|
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
|
|
|
|
{
|
|
|
|
|
PreConfigure<AbpHttpClientBuilderOptions>(options =>
|
|
|
|
|
{
|
|
|
|
|
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) =>
|
|
|
|
|
{
|
|
|
|
|
clientBuilder.AddTransientHttpErrorPolicy(
|
|
|
|
|
policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i)))
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|