NAME
Microsoft::AdCenter::Retry - Defines when and how to retry a failed API call.
SYNOPSIS
my $retry = Microsoft::AdCenter::Retry->new(
ErrorType => Microsoft::AdCenter::Retry->CONNECTION_ERROR | Microsoft::AdCenter::Retry->INTERNAL_SERVER_ERROR,
RetryTimes => 3,
WaitTime => 30,
ScalingWaitTime => 2,
Callback => sub { my $e = shift; warn "Successfully retried API call for " . __PACKAGE__ . " after error $e was caught"; },
);
my $service_client = Microsoft::AdCenter::V7::CampaignManagementService->new
->ApplicationToken("application token")
->CustomerAccountId("customer account id")
->CustomerId("customer id")
->DeveloperToken("developer token")
->Password("password")
->UserName("user name")
->RetrySettings( $retry );
METHODS
ErrorType
Returns / sets the error type you want to retry upon. Can either be CONNECTION_ERROR or INTERNAL_SERVER_ERROR or a combination of the two
RetryTimes
Returns / sets the number of times you want to retry the API call
WaitTime
Returns / sets the time to wait between retries, in seconds
ScalingWaitTime
Returns / sets an optional interval that, will increase the wait time by the interval at each retry. From the above example: 30 seconds on the first try, 60 on the second, 90 on the third, and so on.
Callback
Returns / sets an optional callback sub that will be called upon every retry