This is an automated email from the ASF dual-hosted git repository. dbarnes pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push: new 29dd73b GEODE-8593: Update geode-native examples to use builder pattern: C++ (revisions) 29dd73b is described below commit 29dd73b5ce0253ccd0865aecb0986b4a42aec741 Author: Dave Barnes <dbar...@apache.org> AuthorDate: Mon Oct 19 14:07:23 2020 -0700 GEODE-8593: Update geode-native examples to use builder pattern: C++ (revisions) --- ...onfiguring-pools-attributes-example.html.md.erb | 35 +++++++++++++++++++--- .../getting-started-nc-client.html.md.erb | 9 +++--- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/docs/geode-native-docs-cpp/connection-pools/configuring-pools-attributes-example.html.md.erb b/docs/geode-native-docs-cpp/connection-pools/configuring-pools-attributes-example.html.md.erb index 4696143..1509540 100644 --- a/docs/geode-native-docs-cpp/connection-pools/configuring-pools-attributes-example.html.md.erb +++ b/docs/geode-native-docs-cpp/connection-pools/configuring-pools-attributes-example.html.md.erb @@ -19,17 +19,44 @@ See the License for the specific language governing permissions and limitations under the License. --> -Connection pools require standard client/server distributed system and cache configuration settings. You must also configure settings for the locator, server, and pool elements. +Connection pools require a standard client/server distributed system and cache configuration settings. You must also configure settings for the locator, server, and pool elements. - Locator. Host and port where a server locator is listening. - Server. Host and port where a server is listening. - Pool. Client/server connection pool. -The example shows a declarative pool configuration. Following the example is a table that describes the attributes that can be configured. +This page shows examples of creating a pool configuration programmatically using C++ code, and declaratively using XML. -## Example—Declarative Pool Configuration +## Programmatic Pool Configuration -This example shows a declarative pool configuration. +This example shows a programmatic pool configuration. For a list of the attributes you can configure, see `PoolFactory` in the API docs. + +```cpp +cache.getPoolManager() + .createFactory() + .addLocator("localhost", 34756) + .setFreeConnectionTimeout(std::chrono::milliseconds(12345)) + .setLoadConditioningInterval(std::chrono::milliseconds(23456)) + .setMaxConnections(7) + .setMinConnections(3) + .setPingInterval(std::chrono::milliseconds(12345)) + .setReadTimeout(std::chrono::milliseconds(23456)) + .setRetryAttempts(3) + .setServerGroup("ServerGroup1") + .setSocketBufferSize(32768) + .setStatisticInterval(std::chrono::milliseconds(10123)) + .setSubscriptionAckInterval(std::chrono::milliseconds(567)) + .setSubscriptionEnabled(true) + .setSubscriptionMessageTrackingTimeout(std::chrono::milliseconds(900123)) + .setSubscriptionRedundancy(0) + .setThreadLocalConnections(true) + .create("test_pool_1"); +``` + + +## Declarative Pool Configuration + +This example shows a declarative pool configuration. Following the example is a table that describes the XML pool attributes you can configure. **Note:** You create an instance of `PoolFactory` through `PoolManager`. diff --git a/docs/geode-native-docs-cpp/getting-started/getting-started-nc-client.html.md.erb b/docs/geode-native-docs-cpp/getting-started/getting-started-nc-client.html.md.erb index 9d19505..3a6ca5d 100644 --- a/docs/geode-native-docs-cpp/getting-started/getting-started-nc-client.html.md.erb +++ b/docs/geode-native-docs-cpp/getting-started/getting-started-nc-client.html.md.erb @@ -34,16 +34,15 @@ and [Client/Server Configuration](serverman/topologies_and_comm/cs_configuration To connect to a server, your application must follow these steps: -1. Instantiate a `CacheFactory`, setting characteristics of interest (for example, `log-level`). -1. Create a cache and use it to instantiate a `PoolFactory`, specifying the hostname and port for the server locator. -1. Create a named pool of network connections. +1. Create a cache, setting characteristics of interest (for example, `log-level`). +1. Use the cache to create a named pool of network connections, specifying the hostname and port for at least one server locator. 1. Instantiate a region of the desired type (usually PROXY, sometimes CACHING_PROXY) and connect it by name to its counterpart on the server. Once the connection pool and the shared region are in place, your client application is ready to share data with the server. **Server Connection: C++ Example** -Create a cache and use it to instantiate a `CacheFactory` and set its characteristics: +Create a cache and set its characteristics: ``` cpp auto cache = CacheFactory() @@ -53,7 +52,7 @@ auto cache = CacheFactory() .create(); ``` -Create a pool of network connections: +Use the cache to create a named pool of network connections, specifying the hostname and port for the server locator: ``` cpp