Skip to content

Commit 249167d

Browse files
committed
README.md: Add simple KeyRouteAffinity example
1 parent 68db105 commit 249167d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,21 @@ The driver automatically discovers the partition key.
299299
It periodically runs DescribeTable in the background to retrieve the partition key name.
300300
Until the partition key is discovered, operations run without partition-key optimizations.
301301

302+
#### Simple Configuration with Automatic Discovery
303+
304+
The simplest way to enable KeyRouteAffinity is to let the driver automatically discover partition keys via `DescribeTable`:
305+
```go
306+
h, err := helper.NewHelper(
307+
[]string{"x.x.x.x"},
308+
helper.WithPort(9999),
309+
helper.WithCredentials("whatever", "secret"),
310+
helper.WithKeyRouteAffinity(
311+
helper.NewKeyRouteAffinityConfig(helper.KeyRouteAffinityRMW),
312+
),
313+
)
314+
```
315+
Until the partition key is discovered, requests are routed without optimization. Once discovered, requests for the same partition key are pinned to the same coordinator node.
316+
302317
#### Pre-Configuring Partition Keys with WithPkInfo
303318

304319
If you don't want to wait till driver automatically discovers partition key you can use `WithPkInfo` to pre-configure the

0 commit comments

Comments
 (0)