PGX 2.5.0
Documentation

Client Configuration Guide

PGX provides a couple of client configuration options:

What can be configured?

Field Type Description R? Default
base_urlstringThe base url in the format host [ : port][ /path] of the PGX server REST end-point. If the base_url is null, the default will be used which points to embedded PGX instance.Nonull
enable_cctracebooleanif true log every call to a Control or Core interfaceNofalse
keystorestringpath to the keystore to use for client connections. The keystore is used to authenticate this client at the PGX server if two-way SSL/TLS is enabled.Nonull
max_client_http_connectionsintegerMaximum number of connections to open to the PGX serverNo2
passwordstringThe HTTP Basic Auth passwordNonull
prefetch_sizeintegerHow many items should be prefetched in remote iterators.No2048
remote_future_pending_retry_intervalintegerHow many milliseconds to wait before sending another request in case a GET request for a PgxRemoteFuture receives a 202 - Accepted responseNo500
remote_future_timeoutintegerHow long one GET request for a PgxRemoteFuture will be alive, until it times out and tries again. Time in milliseconds, set it to zero for an infinite timeout. See HTTP Client SO_TIMEOUT for more details.No300000
truststorestringpath to the truststore to use for client connections. The truststore is used to validate the server certificate if communicating over SSL/TLS.Nonull
upload_batch_sizeintegerHow many items will be uploaded in a batch. This is used in Core#addAllToCollection() and Core#setProperty()No65536
usernamestringThe HTTP Basic Auth usernameNonull

How to configure the client

Note that client configuration options obviously do not have any effect when not in remote mode.

PGX Shell

All client configuration fields are available as command-line options:

$PGX_HOME/bin/pgx --base_url https://myhost:8080/pgx --username scott --password tiger --prefetch_size 1024 --upload_batch_size 5000 --remote_future_timeout 20000 --pending_retry_interval 800

To see the full list, run

$PGX_HOME/bin/pgx --help

Java API

Use the corresponding Pgx.getInstance() methods when connection to a PGX instance:

public static ServerInstance getInstance(String baseUrl, String username, String password, Integer prefetchSize, 
      Integer uploadBatchSize, Integer remoteFutureTimeout, Integer remoteFuturePendingRetryInterval)

To specify key store and trust store for SSL connections use the standard JDK system properties:

System.setProperty("javax.net.ssl.trustStore", "<truststore>");
System.setProperty("javax.net.ssl.keyStore", "<keystore>");
System.setProperty("javax.net.ssl.keyStorePassword", "<password>");

JavaScript API

Pass in client configuration options into the pgx.connect() function:

let options = {
  clientKey: fs.readFileSync(<client-key>),
  clientCert: fs.readFileSync(<client-cert>)),
  caCert: fs.readFileSync(<ca-cert>),
  passphrase: <passphrase>,
  prefetchSize: 2048,
  uploadBatchSize: 65536,
  remoteFutureTimeout: 300000,
  remoteFuturePendingRetryInterval: 500
}
let p = pgx.connect('https://myhost:7007', options)