@Override public void init() throws DBException { host = getProperties().getProperty("documentdb.host", null); masterKey = getProperties().getProperty("documentdb.masterKey", null); if (host == null) { System.err.println("ERROR: 'documentdb.host' must be set!"); System.exit(1); } if (masterKey == null) { System.err.println("ERROR: 'documentdb.masterKey' must be set!"); System.exit(1); } databaseId = getProperties().getProperty("documentdb.databaseId", "ycsb"); String collectionId = getProperties().getProperty("documentdb.collectionId", "usertable"); documentClient = new DocumentClient(host, masterKey, ConnectionPolicy.GetDefault(), ConsistencyLevel.Session); try { // Initialize test database and collection. collection = getCollection(collectionId); } catch (DocumentClientException e) { throw new DBException("Initialze collection failed", e); } feedOptions = new FeedOptions(); feedOptions.setEmitVerboseTracesInQuery(false); }
this.useHashQueryForScan, this.queryText); AzureCosmosClient.client = new DocumentClient(uri, primaryKey, connectionPolicy, consistencyLevel); LOGGER.info("Azure Cosmos connection created: {}", uri); } catch (IllegalArgumentException e) {
public static DocumentClient createDocumentClient(String serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { return new DocumentClient(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, null, null, new UserAgentContainer(Constants.Versions.SDK_NAME, Constants.Versions.SDK_VERSION)); }
public DocumentDbFactory(String host, String key, boolean isBiEnabled) { Assert.hasText(host, "host must not be empty!"); Assert.hasText(key, "key must not be empty!"); final ConnectionPolicy policy = ConnectionPolicy.GetDefault(); String userAgent = ";" + USER_AGENT_SUFFIX; if (isBiEnabled && GetHashMac.getHashMac() != null) { userAgent += ";" + GetHashMac.getHashMac(); } policy.setUserAgentSuffix(userAgent); documentClient = new DocumentClient(host, key, policy, ConsistencyLevel.Session); }
public DocumentDbFactory(String host, String key, boolean isBiEnabled) { Assert.hasText(host, "host must not be empty!"); Assert.hasText(key, "key must not be empty!"); final ConnectionPolicy policy = ConnectionPolicy.GetDefault(); String userAgent = ";" + USER_AGENT_SUFFIX; if (isBiEnabled && GetHashMac.getHashMac() != null) { userAgent += ";" + GetHashMac.getHashMac(); } policy.setUserAgentSuffix(userAgent); documentClient = new DocumentClient(host, key, policy, ConsistencyLevel.Session); }
public AsyncDocumentClient build() { ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot build client without service endpoint"); ifThrowIllegalArgException(this.masterKey == null, "cannot build client without masterKey"); if (connectionPolicy != null && ConnectionMode.DirectHttps != connectionPolicy.getConnectionMode()) { return new RxDocumentClientImpl(serviceEndpoint, masterKey, connectionPolicy, desiredConsistencyLevel, eventLoopSize, separateComputationPoolSize); } else { ifThrowIllegalArgException(this.eventLoopSize != -1, "eventLoopSize is not applicable in direct mode"); ifThrowIllegalArgException(this.separateComputationPoolSize != -1, "separateComputationPoolSize is not applicable in direct mode"); // fall back to RX wrapper with blocking IO return new RxWrapperDocumentClientImpl( new DocumentClient(serviceEndpoint.toString(), masterKey, connectionPolicy, desiredConsistencyLevel)); } } }
new DocumentClient(serviceEndpoint.toString(), masterKey, connectionPolicy, consistencyLevel));
public DocumentClient getDocumentClient() { final ConnectionPolicy policy = config.getConnectionPolicy(); final String userAgent = getUserAgentSuffix() + ";" + policy.getUserAgentSuffix(); policy.setUserAgentSuffix(userAgent); return new DocumentClient(config.getUri(), config.getKey(), policy, config.getConsistencyLevel()); }
private DocumentClient createDocumentClient() { LOG.debug("createDocumentClient"); final ConnectionPolicy policy = connectionPolicy == null ? ConnectionPolicy.GetDefault() : connectionPolicy; String userAgent = (policy.getUserAgentSuffix() == null ? "" : ";" + policy.getUserAgentSuffix()) + ";" + USER_AGENT_SUFFIX; if (properties.isAllowTelemetry() && GetHashMac.getHashMac() != null) { userAgent += ";" + GetHashMac.getHashMac(); } policy.setUserAgentSuffix(userAgent); return new DocumentClient(properties.getUri(), properties.getKey(), policy, properties.getConsistencyLevel() == null ? ConsistencyLevel.Session : properties.getConsistencyLevel()); }
private DocumentClient createDocumentClient() { LOG.debug("createDocumentClient"); final ConnectionPolicy policy = connectionPolicy == null ? ConnectionPolicy.GetDefault() : connectionPolicy; String userAgent = (policy.getUserAgentSuffix() == null ? "" : ";" + policy.getUserAgentSuffix()) + ";" + USER_AGENT_SUFFIX; if (properties.isAllowTelemetry() && GetHashMac.getHashMac() != null) { userAgent += ";" + GetHashMac.getHashMac(); } policy.setUserAgentSuffix(userAgent); return new DocumentClient(properties.getUri(), properties.getKey(), policy, properties.getConsistencyLevel() == null ? ConsistencyLevel.Session : properties.getConsistencyLevel()); }
/** * Create document client. * * @param properties the properties * @return the document client */ public DocumentClient createDocumentClient(final BaseCosmosDbProperties properties) { val policy = ConnectionPolicy.GetDefault(); var userAgent = (policy.getUserAgentSuffix() == null ? StringUtils.EMPTY : ';' + policy.getUserAgentSuffix()) + ';' + USER_AGENT_SUFFIX; if (properties.isAllowTelemetry() && GetHashMac.getHashMac() != null) { userAgent += ';' + GetHashMac.getHashMac(); } policy.setUserAgentSuffix(userAgent); return new DocumentClient(properties.getUri(), properties.getKey(), policy, ConsistencyLevel.valueOf(properties.getConsistencyLevel())); }