Skip to content

Commit cee3ee7

Browse files
Merge pull request #292940 from zhiyuanliang-ms/zhiyuanliang/update-replica-doc
Add js example for replica discovery
2 parents 00c4839 + 6485ea7 commit cee3ee7

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

articles/azure-app-configuration/enable-dynamic-configuration-javascript.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ You can connect to App Configuration using either Microsoft Entra ID (recommende
8080
});
8181

8282
```
83+
8384
---
8485

8586
1. Setting up `refreshOptions` alone won't automatically refresh the configuration. You need to call the `refresh` method to trigger a refresh. This design prevents unnecessary requests to App Configuration when your application is idle. You should include the `refresh` call where your application activity occurs. This is known as **activity-driven configuration refresh**. For example, you can call `refresh` when processing an incoming message or an order, or inside an iteration where you perform a complex task. Alternatively, you can use a timer if your application is always active. In this example, `refresh` is called in a loop for demonstration purposes. Even if the `refresh` call fails for any reason, your application will continue to use the cached configuration. Another attempt will be made when the configured refresh interval has passed and the `refresh` call is triggered by your application activity. Calling `refresh` is a no-op before the configured refresh interval elapses, so its performance impact is minimal even if it's called frequently.
@@ -141,6 +142,7 @@ You can connect to App Configuration using either Microsoft Entra ID (recommende
141142
142143
run().catch(console.error);
143144
```
145+
144146
### [Use configuration as object](#tab/configuration-object)
145147

146148
```javascript

articles/azure-app-configuration/howto-geo-replication.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Enable geo-replication
33
description: Learn how to use Azure App Configuration geo replication to create, delete, and manage replicas of your configuration store.
44
services: azure-app-configuration
5-
author: mrm9084
5+
author: zhiyuanliang-ms
66
ms.service: azure-app-configuration
77
ms.devlang: csharp
8-
# ms.devlang: csharp, java
8+
# ms.devlang: csharp, java, python, javascript
99
ms.topic: how-to
10-
ms.date: 09/09/2024
11-
ms.author: mametcal
10+
ms.date: 01/13/2025
11+
ms.author: zhiyuanliang
1212
ms.custom: devx-track-azurecli
1313

1414
#Customer intent: I want to be able to list, create, and delete the replicas of my configuration store.
@@ -132,7 +132,7 @@ spring.cloud.azure.appconfiguration.stores[0].replica-discovery-enabled=false
132132

133133
Update the `AzureAppConfigurationProvider` resource of your Azure App Configuration Kubernetes Provider. Add a `replicaDiscoveryEnabled` property and set it to `false`.
134134

135-
``` yaml
135+
```yaml
136136
apiVersion: azconfig.io/v1
137137
kind: AzureAppConfigurationProvider
138138
metadata:
@@ -159,6 +159,21 @@ config = load(endpoint=endpoint, credential=credential, replica_discovery_enable
159159
> [!NOTE]
160160
> The automatic replica discovery support is available if you use version **1.3.0** or later.
161161

162+
### [JavaScript](#tab/javascript)
163+
164+
Specify the `AzureAppConfigurationOptions.replicaDiscoveryEnabled` property when loading the configuration store and set it to `false`.
165+
166+
167+
```javascript
168+
const config = load(endpoint, credential, {
169+
replicaDiscoveryEnabled: false
170+
});
171+
```
172+
173+
> [!NOTE]
174+
> The automatic replica discovery support is available if you use version **2.0.0-preview.2** or later of [@azure/app-configuration-provider](https://www.npmjs.com/package/@azure/app-configuration-provider).
175+
> The feature is not available for browser-based applications due to the restriction of browser security sandbox.
176+
162177
---
163178

164179
## Scale and failover with replicas
@@ -245,6 +260,10 @@ The Azure App Configuration Kubernetes Provider supports failover with automatic
245260

246261
The Azure App Configuration Python Provider supports failover with automatically discovered replicas by default, as long as automatic replica discovery isn't disabled. It doesn't support or require user-provided replicas.
247262

263+
### [JavaScript](#tab/javascript)
264+
265+
The Azure App Configuration JavaScript Provider supports failover with automatically discovered replicas by default, as long as automatic replica discovery isn't disabled. It doesn't support or require user-provided replicas.
266+
248267
---
249268

250269
The failover may occur if the App Configuration provider observes the following conditions.
@@ -288,7 +307,7 @@ This feature isn't yet supported in the Azure App Configuration Java Spring Prov
288307

289308
Update the `AzureAppConfigurationProvider` resource of your Azure App Configuration Kubernetes Provider. Add a `loadBalancingEnabled` property and set it to `true`.
290309

291-
``` yaml
310+
```yaml
292311
apiVersion: azconfig.io/v1
293312
kind: AzureAppConfigurationProvider
294313
metadata:
@@ -307,6 +326,19 @@ spec:
307326

308327
This feature isn't yet supported in the Azure App Configuration Python Provider.
309328

329+
### [JavaScript](#tab/javascript)
330+
331+
Set `AzureAppConfigurationOptions.loadBalancingEnabled` to `true` while loading configuration from App Configuration.
332+
333+
```javascript
334+
const config = load(endpoint, credential, {
335+
loadBalancingEnabled: true
336+
});
337+
```
338+
339+
> [!NOTE]
340+
> Load balancing support is available if you use version **2.0.0-preview.2** or later of [@azure/app-configuration-provider](https://www.npmjs.com/package/@azure/app-configuration-provider).
341+
310342
---
311343

312344
## Next steps

0 commit comments

Comments
 (0)