Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Partition
Commits
ec201ec7
Commit
ec201ec7
authored
Sep 30, 2021
by
Dmitrii Gerashchenko
Committed by
Krishna Nikhil Vedurumudi
Sep 30, 2021
Browse files
CloudTableClient has no timeouts
parent
f3c5357e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
NOTICE
View file @
ec201ec7
This diff is collapsed.
Click to expand it.
provider/partition-azure/src/main/java/org/opengroup/osdu/partition/provider/azure/di/TableStorageBootstrapConfig.java
View file @
ec201ec7
...
...
@@ -15,12 +15,15 @@
package
org.opengroup.osdu.partition.provider.azure.di
;
import
com.microsoft.azure.storage.CloudStorageAccount
;
import
com.microsoft.azure.storage.RetryLinearRetry
;
import
com.microsoft.azure.storage.StorageException
;
import
com.microsoft.azure.storage.table.CloudTable
;
import
com.microsoft.azure.storage.table.CloudTableClient
;
import
lombok.Setter
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.common.Validators
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -30,10 +33,16 @@ import java.net.URISyntaxException;
import
java.security.InvalidKeyException
;
@Configuration
@ConfigurationProperties
(
prefix
=
"azure.table-storage"
)
@Setter
public
class
TableStorageBootstrapConfig
{
private
final
static
String
CONNECTION_STRING
=
"DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=core.windows.net"
;
private
int
maximumExecutionTimeMs
;
private
int
retryDeltaBackoffMs
;
private
int
retryMaxAttempts
;
@Bean
@Lazy
public
CloudTableClient
getCloudTableClient
(
...
...
@@ -45,7 +54,10 @@ public class TableStorageBootstrapConfig {
final
String
storageConnectionString
=
String
.
format
(
CONNECTION_STRING
,
storageAccountName
,
storageAccountKey
);
CloudStorageAccount
storageAccount
=
CloudStorageAccount
.
parse
(
storageConnectionString
);
return
storageAccount
.
createCloudTableClient
();
CloudTableClient
cloudTableClient
=
storageAccount
.
createCloudTableClient
();
cloudTableClient
.
getDefaultRequestOptions
().
setRetryPolicyFactory
(
new
RetryLinearRetry
(
retryDeltaBackoffMs
,
retryMaxAttempts
));
cloudTableClient
.
getDefaultRequestOptions
().
setMaximumExecutionTimeInMs
(
maximumExecutionTimeMs
);
return
cloudTableClient
;
}
catch
(
URISyntaxException
|
InvalidKeyException
e
)
{
throw
new
AppException
(
HttpStatus
.
SC_INTERNAL_SERVER_ERROR
,
"Error creating cloud table storage client"
,
e
.
getMessage
(),
e
);
}
...
...
provider/partition-azure/src/main/resources/application.properties
View file @
ec201ec7
...
...
@@ -28,6 +28,11 @@ azure.keyvault.url=${KEYVAULT_URI}
# Azure App Insights configuration
azure.application-insights.instrumentation-key
=
${appinsights_key}
#Azure TableStorage
azure.table-storage.retry-delta-backoff-ms
=
2000
azure.table-storage.retry-max-attempts
=
3
azure.table-storage.maximum-execution-time-ms
=
60000
# Cache configuration, provider [vm or redis]
cache.provider
=
redis
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment