Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions content/docs/sdk/python/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
11 changes: 9 additions & 2 deletions content/docs/sdk/rust/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down Expand Up @@ -86,7 +91,9 @@ use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
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.
Expand Down