You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to the documentation for the RabbitMQ Stream Rust Client. This guide provides comprehensive information on installation, usage, and examples.
37
39
38
-
</div>
40
+
## Table of Contents
41
+
1.[Introduction](#introduction)
42
+
2.[Installation](#installation)
43
+
3.[Getting Started](#getting-started)
44
+
4.[Usage](#usage)
45
+
-[Publishing Messages](#publishing-messages)
46
+
-[Consuming Messages](#consuming-messages)
47
+
-[Super Stream](#super-stream)
48
+
5.[Examples](#examples)
49
+
6.[Development](#development)
50
+
-[Compiling](#Compiling)
51
+
-[Running Tests](#running-tests)
52
+
-[Running Benchmarks](#running-benchmarks)
53
+
-[Contributing](#contributing)
54
+
-[License](#license)
39
55
56
+
## Introduction
40
57
41
-
#RabbitMQ Stream Client
58
+
The RabbitMQ Stream Rust Client is a library designed for integrating Rust applications with RabbitMQ streams efficiently. It supports high throughput and low latency message streaming.
42
59
43
-
This is a Rust client library for working with [RabbitMQ Streams](https://www.rabbitmq.com/docs/streams).
60
+
## Installation
44
61
45
-
### Installation
46
-
47
-
Install from [crates.io](https://crates.io/)
62
+
Install from [crates.io](https://crates.io/crates/rabbitmq-stream-client)
48
63
49
64
```toml
50
65
[dependencies]
51
66
rabbitmq-stream-client = "*"
52
67
```
53
68
54
-
### Quick Start
55
-
56
-
The main access point is `Environment`, which is used to connect to a node.
69
+
Then run `cargo build `to include it in your project.
57
70
58
-
#### Example
71
+
## Getting Started
72
+
This section covers the initial setup and necessary steps to incorporate the RabbitMQ Stream client into your Rust application.
59
73
60
-
##### Building the environment
74
+
Ensure RabbitMQ server with stream support is installed.
75
+
The main access point is `Environment`, which is used to connect to a node.
61
76
62
77
```rust,no_run
63
78
use rabbitmq_stream_client::Environment;
64
79
let environment = Environment::builder().build().await?;
65
80
```
66
-
67
-
##### Building the environment with TLS
81
+
### Environment with TLS
68
82
69
83
```rust,no_run
70
84
use rabbitmq_stream_client::Environment;
@@ -86,7 +100,10 @@ let environment = Environment::builder()
86
100
.build()
87
101
```
88
102
89
-
##### Building the environment with a load balancer
103
+
### Environment with a load balancer
104
+
105
+
106
+
See the [documentation](https://www.rabbitmq.com/blog/2021/07/23/connecting-to-streams#with-a-load-balancer) about the stream and load-balancer.
90
107
91
108
```rust,no_run
92
109
use rabbitmq_stream_client::Environment;
@@ -99,21 +116,16 @@ let environment = Environment::builder()
99
116
100
117
101
118
102
-
##### Publishing messages
119
+
## Publishing messages
120
+
121
+
You can publish messages with three different methods:
122
+
123
+
*`send`: asynchronous, messages are automatically buffered internally and sent at once after a timeout expires. On confirmation a callback is triggered. See the [example](./examples/send_async.rs)
124
+
*`batch_send`: synchronous, the user buffers the messages and sends them. This is the fastest publishing method. On confirmation a callback is triggered. See the [example](./examples/batch_send.rs)
125
+
*`send_with_confirm`: synchronous, the caller wait till the message is confirmed. This is the slowest publishing method. See the [example](./examples/send_with_confirm.rs)
103
126
104
-
```rust,no_run
105
-
use rabbitmq_stream_client::{Environment, types::Message};
106
-
let environment = Environment::builder().build().await?;
107
-
let producer = environment.producer().name("myproducer").build("mystream").await?;
The client supports the superstream functionality.
152
+
### Super Stream
153
+
154
+
The client supports the super-stream functionality.
142
155
143
156
A super stream is a logical stream made of individual, regular streams. It is a way to scale out publishing and consuming with RabbitMQ Streams: a large logical stream is divided into partition streams, splitting up the storage and the traffic on several cluster nodes.
144
157
@@ -152,16 +165,21 @@ See the [Super Stream Producer Example:](https://github.com/rabbitmq/rabbitmq-st
152
165
153
166
See the [Super Stream Consumer Example:](https://github.com/rabbitmq/rabbitmq-stream-rust-client/blob/main/examples/receive_super_stream.rs)
154
167
155
-
### Development
168
+
### Examples
169
+
170
+
Refer to the [examples](./examples) directory for detailed code samples illustrating various use cases
171
+
like error handling, batch processing, super streams and different ways to send messages.
0 commit comments