diff --git a/content/docs/sdk/python/intro.mdx b/content/docs/sdk/python/intro.mdx index 9c19f80009..dbe2f9fe41 100644 --- a/content/docs/sdk/python/intro.mdx +++ b/content/docs/sdk/python/intro.mdx @@ -43,6 +43,8 @@ cargo run --bin iggy-server -- --fresh --with-default-root-credentials The environment variables make the server reachable through the published port (it binds to `127.0.0.1` inside the container by default) and bootstrap the `iggy`/`iggy` root credentials for new data. Stored credentials are not replaced. Environment credentials override the default-credentials flag, so unset them or set them to match the sample. `--fresh` deletes local replica state; use disposable development data. A new standalone server without explicit credentials generates a root password; a new cluster requires explicit credentials. +The producer and consumer examples use `reconnection_retries=0` so `await client.connect()` raises an error after the first failed connection attempt. Without this setting, the SDK retries indefinitely by default. + ### Producer ```python @@ -58,7 +60,7 @@ PARTITION_ID = 0 async def main(): client = IggyClient.from_connection_string( - "iggy+tcp://iggy:iggy@127.0.0.1:8090" + "iggy+tcp://iggy:iggy@127.0.0.1:8090?reconnection_retries=0" ) await client.connect() @@ -101,7 +103,7 @@ PARTITION_ID = 0 async def main(): client = IggyClient.from_connection_string( - "iggy+tcp://iggy:iggy@127.0.0.1:8090" + "iggy+tcp://iggy:iggy@127.0.0.1:8090?reconnection_retries=0" ) await client.connect() diff --git a/content/docs/sdk/rust/intro.mdx b/content/docs/sdk/rust/intro.mdx index 53d80901ea..ed9f899afe 100644 --- a/content/docs/sdk/rust/intro.mdx +++ b/content/docs/sdk/rust/intro.mdx @@ -29,17 +29,22 @@ The SDK provides two layers. The snippets below assume an async Tokio context wi **High-level API (recommended)** - the easiest way to get started. It handles connection management, auto-batching, consumer group lifecycle, offset commits, retry logic, and reconnection out of the box. Use `IggyClient`, `IggyProducer`, and `IggyConsumer` for the best developer experience. +By default, the SDK retries connections indefinitely. The examples below use `reconnection_retries=0` or `.with_reconnection_max_retries(Some(0))` so `connect()` returns an error after the first failed connection attempt. + ```rust use iggy::prelude::*; // Connect with a connection string -let client = IggyClient::from_connection_string("iggy://iggy:iggy@127.0.0.1:8090")?; +let client = IggyClient::from_connection_string( + "iggy://iggy:iggy@127.0.0.1:8090?reconnection_retries=0", +)?; client.connect().await?; // Or use the builder let client = IggyClientBuilder::new() .with_tcp() .with_server_address("127.0.0.1:8090".to_string()) + .with_reconnection_max_retries(Some(0)) .build()?; client.connect().await?; client.login_user("iggy", "iggy").await?; @@ -86,7 +91,9 @@ use std::str::FromStr; #[tokio::main] async fn main() -> Result<(), Box> { - let client = IggyClient::from_connection_string("iggy://iggy:iggy@127.0.0.1:8090")?; + let client = IggyClient::from_connection_string( + "iggy://iggy:iggy@127.0.0.1:8090?reconnection_retries=0", + )?; client.connect().await?; // Re-running this example is fine: an existing stream or topic is not an error.