Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Amazon Shipping,FedEx, Usps, Stamps.com Shipping Implementations

License

NotificationsYou must be signed in to change notification settings

easykeys/EasyKeys.Shipping

Repository files navigation

Build statusNuGetNugetfeedz.io

EasyKeys.com production ready shipment library for FedEx, Stamps and USPS shipping providers.

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Reusable Abstractions

FedEx Shipping

Stamps Shipping

USPS Shipping

Poly policy Sample

varrequest=newValidateAddress(model?.RequestId??Guid.NewGuid().ToString(),originalAddress,originalAddress);varresponse=await_policy.ExecuteAsync(async(ctx,ct)=>await_validationProvider.ValidateAddressAsync(request,ct),newContext{[_policyContextMethod]="ValidateAsync"},cancellationToken);privateIAsyncPolicyGetRetryWithTimeOutPolicy(){// each call is limited to 30 seconds in case when fedex is non-reponsive and it is 1min timeout, it is way to long// The request channel timed out attempting to send after 00:01:00.// Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.vartimeoutPolicy=Policy.TimeoutAsync(30,TimeoutStrategy.Pessimistic);varjitterer=newRandom();returnPolicy.Handle<TimeoutRejectedException>().WaitAndRetryAsync(retryCount:3,// exponential back-off plus some jittersleepDurationProvider:(retryAttempt,context)=>{returnTimeSpan.FromSeconds(Math.Pow(2,retryAttempt))+TimeSpan.FromMilliseconds(jitterer.Next(0,200));},onRetry:(ex,span,context)=>{varmethodName=context[_policyContextMethod]??"MethodNotSpecified";_logger.LogWarning("{Method} wait {Seconds} to execute with exception: {Message} for named policy: {Policy}",methodName,span.TotalSeconds,ex.Message,context.PolicyKey);}).WithPolicyKey($"{nameof(FedExAddressValidationProvider)}WaitAndRetryAsync").WrapAsync(timeoutPolicy);}

References


[8]ページ先頭

©2009-2025 Movatter.jp