Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

[FEATURE] Add support for overriding default Direct TCP options #298

Closed David-Noble-at-work closed 4 years ago

David-Noble-at-work commented 4 years ago

When this issue is resolved you will be able to set Direct TCP options. In priority order we will take default Direct TCP options from:

  1. The string value of system property azure.cosmos.directTcp.defaultOptions. Example:

    -Dazure.cosmos.directTcp.defaultOptions={\"maxChannelsPerEndpoint\":5,\"maxRequestsPerChannel\":30}
  2. The contents of the file located by system property azure.cosmos.directTcp.defaultOptionsFile. Example:

    -Dazure.cosmos.directTcp.defaultOptionsFile=/path/to/default/options/file
  3. The contents of the resource file named azure.cosmos.directTcp.defaultOptions.json. Specifically, the resource file is read from this stream:

    RntbdTransportClient.class.getClassLoader().getResourceAsStream("azure.cosmos.directTcp.defaultOptions.json")

    Example: Contents of resource file azure.cosmos.directTcp.defaultOptions.json.

    
    {
     "bufferPageSize": 8192,
     "connectionTimeout": "PT1M",
     "idleChannelTimeout": "PT0S",
     "idleEndpointTimeout": "PT1M10S",
     "maxBufferCapacity": 8388608,
     "maxChannelsPerEndpoint": 10,
     "maxRequestsPerChannel": 30,
     "receiveHangDetectionTime": "PT1M5S",
     "requestExpiryInterval": "PT5S",
     "requestTimeout": "PT1M",
     "requestTimerResolution": "PT0.5S",
     "sendHangDetectionTime": "PT10S",
     "shutdownTimeout": "PT15S"
    }
  4. Otherwise, if none of these values are set or all set values are in error we will create default options based on a set of hard-wired values defined in the default private parameterless constructor for RntbdTransportClient.Options.

David-Noble-at-work commented 4 years ago

Work completed. See PR#308.