Skip to content

Commit bccea43

Browse files
committed
Update examples and home page
1 parent 21a2115 commit bccea43

11 files changed

Lines changed: 361 additions & 50 deletions

File tree

content/docs/sdk/csharp/intro.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: C# SDK
33
---
44

5-
The Iggy SDK for C# is a library that allows you to interact with the Iggy API from your .NET applications. It communicates with the Iggy server over TCP using the binary protocol. The repository can be found [here](https://github.com/apache/iggy/tree/master/foreign/csharp).
5+
The Iggy SDK for C# is a library that allows you to interact with the Iggy API from your .NET applications. It supports TCP and HTTP transports. The package is available on [NuGet](https://www.nuget.org/packages/Apache.Iggy/) and the source code can be found on [GitHub](https://github.com/apache/iggy/tree/master/foreign/csharp).
66

77
## Installation
88

@@ -109,10 +109,10 @@ while (true)
109109
Working examples are available in the [examples/csharp](https://github.com/apache/iggy/tree/master/examples/csharp) directory. The following example sets are included:
110110

111111
- **GettingStarted** - basic producer and consumer
112+
- **Basic** - producer and consumer with settings
113+
- **NewSdk** - new high-level SDK API patterns
112114
- **MessageEnvelope** - working with message envelopes
113115
- **MessageHeaders** - custom message headers
114-
- **MultiTenant** - multi-tenant streaming setup
115116
- **TcpTls** - TLS-encrypted TCP connections
116-
- **StreamBuilder** - stream builder API usage
117117

118118
The solution can be opened with Visual Studio or built with `dotnet build`.

content/docs/sdk/go/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Go SDK
33
---
44

5-
The Iggy Go SDK is a client library that allows you to interact with the Iggy API from your Go application. It communicates with the Iggy server over TCP using the binary protocol. The repository can be found [here](https://github.com/apache/iggy/tree/master/foreign/go).
5+
The Iggy Go SDK is a client library that allows you to interact with the Iggy API from your Go application. It communicates with the Iggy server over TCP using the binary protocol. The package is available on [pkg.go.dev](https://pkg.go.dev/github.com/apache/iggy/foreign/go) and the source code can be found on [GitHub](https://github.com/apache/iggy/tree/master/foreign/go).
66

77
## Installation
88

content/docs/sdk/java/examples.mdx

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,100 @@
11
---
22
title: Examples
33
---
4+
5+
Working examples are available in the [examples/java](https://github.com/apache/iggy/tree/master/examples/java) directory as a Gradle project. The following example sets are included:
6+
7+
- **gettingstarted** - basic blocking TCP producer and consumer
8+
- **async** - asynchronous producer and consumer
9+
- **messageenvelope** - JSON message envelope pattern
10+
- **messageheaders** - custom message headers
11+
- **multitenant** - multi-tenant isolation with per-tenant streams
12+
- **tcptls** - TLS-encrypted TCP connections
13+
- **sinkdataproducer** - bulk random data generation
14+
- **streambuilder** - combined producer and consumer in one class
15+
16+
## Producer
17+
18+
```java
19+
import org.apache.iggy.client.blocking.tcp.IggyTcpClient;
20+
import org.apache.iggy.identifier.StreamId;
21+
import org.apache.iggy.identifier.TopicId;
22+
import org.apache.iggy.message.Message;
23+
import org.apache.iggy.message.Partitioning;
24+
import org.apache.iggy.topic.CompressionAlgorithm;
25+
import java.math.BigInteger;
26+
import java.util.List;
27+
import static java.util.Optional.empty;
28+
29+
public class Producer {
30+
public static void main(String[] args) {
31+
try (var client = IggyTcpClient.builder()
32+
.host("localhost")
33+
.port(8090)
34+
.credentials("iggy", "iggy")
35+
.buildAndLogin()) {
36+
37+
var streamId = StreamId.of("sample-stream");
38+
var topicId = TopicId.of("sample-topic");
39+
40+
client.streams().createStream("sample-stream");
41+
client.topics().createTopic(
42+
streamId, 1L,
43+
CompressionAlgorithm.None,
44+
BigInteger.ZERO, BigInteger.ZERO,
45+
empty(), "sample-topic");
46+
47+
var partitioning = Partitioning.partitionId(0L);
48+
var messages = List.of(Message.of("hello world"));
49+
client.messages().sendMessages(
50+
streamId, topicId,
51+
partitioning, messages);
52+
}
53+
}
54+
}
55+
```
56+
57+
## Consumer
58+
59+
```java
60+
import org.apache.iggy.client.blocking.tcp.IggyTcpClient;
61+
import org.apache.iggy.consumergroup.Consumer;
62+
import org.apache.iggy.identifier.StreamId;
63+
import org.apache.iggy.identifier.TopicId;
64+
import org.apache.iggy.message.Message;
65+
import org.apache.iggy.message.PolledMessages;
66+
import org.apache.iggy.message.PollingStrategy;
67+
import java.math.BigInteger;
68+
import java.nio.charset.StandardCharsets;
69+
import java.util.Optional;
70+
71+
public class ConsumerExample {
72+
public static void main(String[] args) {
73+
try (var client = IggyTcpClient.builder()
74+
.host("localhost")
75+
.port(8090)
76+
.credentials("iggy", "iggy")
77+
.buildAndLogin()) {
78+
79+
var streamId = StreamId.of("sample-stream");
80+
var topicId = TopicId.of("sample-topic");
81+
var consumer = Consumer.of(0L);
82+
83+
PolledMessages polled = client.messages()
84+
.pollMessages(
85+
streamId, topicId,
86+
Optional.of(0L), consumer,
87+
PollingStrategy.offset(BigInteger.ZERO),
88+
10L, false);
89+
90+
for (Message message : polled.messages()) {
91+
String payload = new String(
92+
message.payload(), StandardCharsets.UTF_8);
93+
System.out.println("Payload: " + payload);
94+
}
95+
}
96+
}
97+
}
98+
```
99+
100+
For the full source code, see the [examples/java](https://github.com/apache/iggy/tree/master/examples/java) directory.

content/docs/sdk/java/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Java SDK
33
---
44

5-
The Iggy Java SDK is a library that allows you to interact with the Iggy API from your Java application. It communicates with the Iggy server over TCP using the binary protocol. The repository can be found [here](https://github.com/apache/iggy/tree/master/foreign/java).
5+
The Iggy Java SDK is a library that allows you to interact with the Iggy API from your Java application. It supports TCP and HTTP transports. The package is available on [Maven Central](https://mvnrepository.com/artifact/org.apache.iggy/iggy) and the source code can be found on [GitHub](https://github.com/apache/iggy/tree/master/foreign/java).
66

77
## Installation
88

content/docs/sdk/node/examples.mdx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,89 @@
11
---
22
title: Examples
33
---
4+
5+
Working examples are available in the [examples/node](https://github.com/apache/iggy/tree/master/examples/node) directory, written in TypeScript. The following example sets are included:
6+
7+
- **getting-started** - basic producer and consumer
8+
- **basic** - producer and consumer with utilities
9+
- **message-envelope** - JSON message envelope pattern
10+
- **message-headers** - custom message headers
11+
- **multi-tenant** - multi-tenant streaming setup
12+
- **tcp-tls** - TLS-encrypted TCP connections
13+
- **stream-builder** - stream builder API usage
14+
- **sink-data-producer** - bulk data generation for sink connectors
15+
16+
## Producer
17+
18+
```typescript
19+
import { Client, Partitioning } from 'apache-iggy';
20+
21+
const client = new Client({
22+
transport: 'TCP',
23+
options: { port: 8090, host: '127.0.0.1', keepAlive: true },
24+
credentials: { username: 'iggy', password: 'iggy' },
25+
});
26+
27+
const stream = await client.stream.create({ name: 'sample-stream' });
28+
const topic = await client.topic.create({
29+
streamId: stream.id,
30+
name: 'sample-topic',
31+
partitionCount: 1,
32+
compressionAlgorithm: 1,
33+
replicationFactor: 1,
34+
});
35+
36+
const messages = Array.from({ length: 10 }, (_, i) => ({
37+
id: i + 1,
38+
headers: [],
39+
payload: `message-${i + 1}`,
40+
}));
41+
42+
await client.message.send({
43+
streamId: stream.id,
44+
topicId: topic.id,
45+
messages,
46+
partition: Partitioning.PartitionId(
47+
topic.partitions[0].id
48+
),
49+
});
50+
51+
await client.destroy();
52+
```
53+
54+
## Consumer
55+
56+
```typescript
57+
import { Client, PollingStrategy, Consumer } from 'apache-iggy';
58+
59+
const STREAM_ID = 1;
60+
const TOPIC_ID = 1;
61+
const PARTITION_ID = 0;
62+
63+
const client = new Client({
64+
transport: 'TCP',
65+
options: { port: 8090, host: '127.0.0.1' },
66+
credentials: { username: 'iggy', password: 'iggy' },
67+
});
68+
69+
const polledMessages = await client.message.poll({
70+
streamId: STREAM_ID,
71+
topicId: TOPIC_ID,
72+
consumer: Consumer.Single,
73+
partitionId: PARTITION_ID,
74+
pollingStrategy: PollingStrategy.Offset(BigInt(0)),
75+
count: 10,
76+
autocommit: false,
77+
});
78+
79+
for (const message of polledMessages.messages) {
80+
const payload = message.payload.toString('utf8');
81+
console.log(
82+
`Offset: ${message.headers.offset}, Payload: ${payload}`
83+
);
84+
}
85+
86+
await client.destroy();
87+
```
88+
89+
For the full source code, see the [examples/node](https://github.com/apache/iggy/tree/master/examples/node) directory.

content/docs/sdk/node/intro.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Node.js SDK
33
---
44

5-
The Iggy Node.js SDK is a client library that allows you to interact with the Iggy API from your Node.js and TypeScript applications. It communicates with the Iggy server over TCP using the binary protocol. The repository can be found [here](https://github.com/apache/iggy/tree/master/foreign/node).
5+
The Iggy Node.js SDK is a client library that allows you to interact with the Iggy API from your Node.js and TypeScript applications. It communicates with the Iggy server over TCP using the binary protocol. The package is available on [npm](https://www.npmjs.com/package/apache-iggy) and the source code can be found on [GitHub](https://github.com/apache/iggy/tree/master/foreign/node).
66

77
## Installation
88

@@ -87,9 +87,10 @@ if (polledMessages && polledMessages.messages.length > 0) {
8787
Working examples are available in the [examples/node](https://github.com/apache/iggy/tree/master/examples/node) directory, written in TypeScript. The following example sets are included:
8888

8989
- **getting-started** - basic producer and consumer
90-
- **async** - asynchronous message processing
90+
- **basic** - producer and consumer with utilities
9191
- **message-envelope** - working with message envelopes
9292
- **message-headers** - custom message headers
9393
- **multi-tenant** - multi-tenant streaming setup
9494
- **tcp-tls** - TLS-encrypted TCP connections
9595
- **stream-builder** - stream builder API usage
96+
- **sink-data-producer** - bulk data generation for sink connectors
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
11
---
22
title: Examples
33
---
4+
5+
Working examples are available in the [examples/python](https://github.com/apache/iggy/tree/master/examples/python) directory.
6+
7+
- **basic** - producer and consumer using connection strings
8+
- **getting-started** - producer and consumer with TLS support
9+
10+
## Producer
11+
12+
```python
13+
import asyncio
14+
from apache_iggy import IggyClient
15+
from apache_iggy import SendMessage as Message
16+
17+
STREAM_NAME = "sample-stream"
18+
TOPIC_NAME = "sample-topic"
19+
PARTITION_ID = 0
20+
21+
async def main():
22+
client = IggyClient.from_connection_string(
23+
"iggy+tcp://iggy:iggy@127.0.0.1:8090"
24+
)
25+
await client.connect()
26+
27+
await client.create_stream(name=STREAM_NAME)
28+
await client.create_topic(
29+
stream=STREAM_NAME,
30+
partitions_count=1,
31+
name=TOPIC_NAME,
32+
replication_factor=1,
33+
)
34+
35+
messages = []
36+
for i in range(10):
37+
messages.append(Message(f"message-{i}"))
38+
39+
await client.send_messages(
40+
stream=STREAM_NAME,
41+
topic=TOPIC_NAME,
42+
partitioning=PARTITION_ID,
43+
messages=messages,
44+
)
45+
46+
asyncio.run(main())
47+
```
48+
49+
## Consumer
50+
51+
```python
52+
import asyncio
53+
from apache_iggy import IggyClient, PollingStrategy, ReceiveMessage
54+
55+
STREAM_NAME = "sample-stream"
56+
TOPIC_NAME = "sample-topic"
57+
PARTITION_ID = 0
58+
59+
async def main():
60+
client = IggyClient.from_connection_string(
61+
"iggy+tcp://iggy:iggy@127.0.0.1:8090"
62+
)
63+
await client.connect()
64+
65+
polled_messages = await client.poll_messages(
66+
stream=STREAM_NAME,
67+
topic=TOPIC_NAME,
68+
partition_id=PARTITION_ID,
69+
polling_strategy=PollingStrategy.Next(),
70+
count=10,
71+
auto_commit=True,
72+
)
73+
74+
for message in polled_messages:
75+
payload = message.payload().decode("utf-8")
76+
print(f"Offset: {message.offset()}, Payload: {payload}")
77+
78+
asyncio.run(main())
79+
```
80+
81+
For the full source code, see the [examples/python](https://github.com/apache/iggy/tree/master/examples/python) directory.

content/docs/sdk/python/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Python SDK
33
---
44

5-
The Iggy Python SDK is a client library that allows you to interact with the Iggy API from your Python application. It is built as a PyO3 wrapper around the Rust SDK, which means it supports TCP, QUIC, and HTTP transports. The repository can be found [here](https://github.com/apache/iggy/tree/master/foreign/python).
5+
The Iggy Python SDK is a client library that allows you to interact with the Iggy API from your Python application. It is built as a PyO3 wrapper around the Rust SDK, which means it supports TCP, QUIC, HTTP, and WebSocket transports via connection strings. The package is available on [PyPI](https://pypi.org/project/apache-iggy/) and the source code can be found on [GitHub](https://github.com/apache/iggy/tree/master/foreign/python).
66

77
## Installation
88

content/docs/sdk/rust/examples.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ title: Examples
55
In the core repository, you can find the following [examples](https://github.com/apache/iggy/tree/master/examples/rust/src) using the Rust SDK:
66

77
- **Getting started** - the basic example which is discussed in the [getting started](/docs/introduction/getting-started) guide.
8+
- **Basic** - producer and consumer using the low-level `Client` trait with CLI args for transport selection (TCP/QUIC/HTTP).
9+
- **New SDK** - an introduction to the high-level SDK as discussed in the [dedicated guide](/docs/sdk/rust/high-level-sdk).
10+
- **Stream builder** - examples using the `IggyStream`, `IggyStreamProducer`, and `IggyStreamConsumer` builder APIs as discussed in the [stream builder guide](/docs/sdk/rust/stream-builder).
811
- **Message envelope** - the example of how to send a message with a custom envelope e.g. to differentiate between different types of messages.
9-
- **Message headers** - the example of how to send a message with custom headers e.g. to differentiate between different types of messages.
12+
- **Message headers** - the example of how to send a message with custom headers (typed headers, message type discrimination, client-side compression).
1013
- **Multi-tenant** - the comprehensive example of how to structure your application to support multiple tenants (separated by the unique streams) with the different users, permissions, topics etc.
11-
- **New SDK** - an introduction to the high-level SDK as discussed in the [dedicated guide](/docs/sdk/rust/high-level-sdk).
14+
- **TCP TLS** - TLS-encrypted TCP connections with custom CA certificates.
15+
- **Sink data producer** - generating random JSON records in bulk batches for sink connector testing.

src/components/benchmark-chart.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function BenchmarkSection() {
3333

3434
const wrAvg = CY(1.01);
3535
const wrP99 = CY(2.05);
36+
const rdAvg = CY(1.19);
3637

3738
return (
3839
<div ref={ref}>
@@ -120,13 +121,15 @@ export function BenchmarkSection() {
120121
<path d={READ_PATH} fill="none" stroke="#38bdf8" strokeWidth="1.5" strokeLinejoin="round" className="iggy-line iggy-line-rd" />
121122

122123
<g className="iggy-label">
123-
<line x1="0" y1={wrAvg} x2="600" y2={wrAvg} stroke="#ff9103" strokeOpacity="0.25" strokeDasharray="4 3" />
124-
<rect x="540" y={wrAvg - 11} width="56" height="18" rx="4" fill="#ff9103" fillOpacity="0.12" />
125-
<text x="568" y={wrAvg + 2} textAnchor="middle" fill="#ff9103" fontSize="10" fontFamily="monospace" fontWeight="600">AVG</text>
126-
127-
<line x1="0" y1={wrP99} x2="600" y2={wrP99} stroke="#ff9103" strokeOpacity="0.15" strokeDasharray="4 3" />
128-
<rect x="540" y={wrP99 - 11} width="56" height="18" rx="4" fill="#ff9103" fillOpacity="0.08" />
129-
<text x="568" y={wrP99 + 2} textAnchor="middle" fill="#ff9103" fontSize="10" fontFamily="monospace" fillOpacity="0.7">P99</text>
124+
<line x1="0" y1={wrAvg} x2="600" y2={wrAvg} stroke="#ff9103" strokeOpacity="0.3" strokeDasharray="6 6" strokeWidth="1" />
125+
<rect x="539" y={wrAvg - 11} width="58" height="22" rx="4" fill="#060a12" />
126+
<rect x="539" y={wrAvg - 11} width="58" height="22" rx="4" fill="#ff9103" fillOpacity="0.15" stroke="#ff9103" strokeOpacity="0.4" strokeWidth="0.5" />
127+
<text x="568" y={wrAvg + 4} textAnchor="middle" fill="#ff9103" fontSize="11" fontFamily="monospace" fontWeight="bold">AVG</text>
128+
129+
<line x1="0" y1={wrP99} x2="600" y2={wrP99} stroke="#ff9103" strokeOpacity="0.2" strokeDasharray="6 6" strokeWidth="1" />
130+
<rect x="539" y={wrP99 - 11} width="58" height="22" rx="4" fill="#060a12" />
131+
<rect x="539" y={wrP99 - 11} width="58" height="22" rx="4" fill="#ff9103" fillOpacity="0.1" stroke="#ff9103" strokeOpacity="0.3" strokeWidth="0.5" />
132+
<text x="568" y={wrP99 + 4} textAnchor="middle" fill="#ff9103" fontSize="11" fontFamily="monospace" fontWeight="bold">P99</text>
130133
</g>
131134
</svg>
132135
</div>

0 commit comments

Comments
 (0)