Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03612c0

Browse files
authored
Merge branch 'master' into master
2 parents027b84f +af3b346 commit03612c0

37 files changed

+799
-515
lines changed

‎.vscode/launch.json

Lines changed: 340 additions & 340 deletions
Large diffs are not rendered by default.

‎CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
##[0.9.0] 2022-04-29
1111

1212
- Updated to support Rust 2021
13-
- Brought all of thedependancies up to date, so this could cause**breaking changes**
13+
- Brought all of thedependencies up to date, so this could cause**breaking changes**
1414
- Removed the try! methods
1515
- Updated the error mechanism to use thiserror and anyhow.
1616
- Removed error-chain, as it is deprecated

‎Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
name ="kafka"
33
version ="0.9.0"
44
authors = ["Yousuf Fauzan","Petr Novotnik <pnovotnik@googlemail.com>"]
5-
description ="Rust client for Apache Kafka"
6-
repository ="https://github.com/kafka-rust/kafka-rust"
7-
documentation ="https://docs.rs/kafka/"
8-
readme ="README.md"
9-
keywords = ["kafka","queue"]
105
categories = ["api-bindings"]
11-
license ="MIT"
6+
documentation ="https://docs.rs/kafka/"
127
edition ="2021"
8+
keywords = ["kafka","queue"]
9+
license ="MIT OR Apache-2.0"
10+
readme ="README.md"
11+
repository ="https://github.com/kafka-rust/kafka-rust"
12+
description ="Rust client for Apache Kafka"
1313

1414
[dependencies]
1515
byteorder ="1.4.3"
16-
crc ="2.1.0"
17-
ref_slice ="1.2.1"
16+
crc ="3.0.0"
1817
fnv ="1.0.7"
19-
twox-hash ="1.6.2"
18+
ref_slice ="1.2.1"
19+
twox-hash ="1.6.3"
2020

21-
flate2 = {version ="1.0.22",optional =true }
21+
flate2 = {version ="1.0.23",optional =true }
22+
openssl = {version ="0.10.40",optional =true }
23+
openssl-sys = {version ="0.9.73",optional =true }
2224
snap = {version ="1.0.5",optional =true }
23-
openssl = {version ="0.10.38",optional =true }
24-
openssl-sys = {version ="0.9.72",optional =true }
25-
thiserror ="1.0.30"
26-
tracing ="0.1.31"
25+
thiserror ="1.0.31"
26+
tracing ="0.1.34"
2727

2828
[dev-dependencies]
2929
getopts ="0.2.21"

‎README.md

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,34 @@ Welcome to kafka-rust's new home: https://github.com/kafka-rust
1212

1313
##Documentation
1414

15-
* This library is primarily documented through examples in its[API
16-
documentation](https://docs.rs/kafka/).
17-
* Documentation about Kafka itself can be found at[its project
18-
home page](http://kafka.apache.org/).
15+
- This library is primarily documented through examples in its[APIdocumentation](https://docs.rs/kafka/).
16+
- Documentation about Kafka itself can be found at[its projecthome page](http://kafka.apache.org/).
1917

18+
##Sponsors
19+
20+
Thank you to our sponsors, this helps me to spend more time on this project and also helps with infrastructure
21+
22+
<table>
23+
<tr>
24+
<td>
25+
<imgwidth="1000"height="0">
26+
<a href="https://upstash.com/?utm_source=kafka-rust" >
27+
<imgsrc="https://raw.githubusercontent.com/upstash/sponsorship/master/kafka.png"alt="Upstash"width="260"align="right">
28+
</a>
29+
30+
<h3>Upstash: Serverless Kafka</h3>
31+
32+
<ul>
33+
<li>True Serverless Kafka with per-request-pricing</li>
34+
<li>Managed Apache Kafka, works with all Kafka clients</li>
35+
<li>Built-in REST API designed for serverless and edge functions</li>
36+
</ul>
37+
38+
[Start for free in 30 seconds!](https://upstash.com/?utm_source=kafka-rust)
39+
40+
</td>
41+
</tr>
42+
</table>
2043

2144
##Installation
2245

@@ -27,13 +50,12 @@ expect the version number to grow quickly).
2750

2851
```toml
2952
[dependencies]
30-
kafka ="0.8"
53+
kafka ="0.9"
3154
```
3255

3356
To build kafka-rust the usual`cargo build` should suffice. The crate
3457
supports various features which can be turned off at compile time.
35-
See kafka-rust's`Cargo.toml` and[cargo's
36-
documentation](http://doc.crates.io/manifest.html#the-features-section).
58+
See kafka-rust's`Cargo.toml` and[cargo'sdocumentation](http://doc.crates.io/manifest.html#the-features-section).
3759

3860
##Supported Kafka version
3961

@@ -42,12 +64,9 @@ not all features from Kafka 0.9 and newer are supported yet.
4264

4365
##Examples
4466

45-
As mentioned, the[cargo generated
46-
documentation](https://docs.rs/kafka/) contains some examples.
67+
As mentioned, the[cargo generateddocumentation](https://docs.rs/kafka/) contains some examples.
4768
Further, standalone, compilable example programs are provided in the
48-
[examples directory of the
49-
repository](https://github.com/spicavigo/kafka-rust/tree/master/examples).
50-
69+
[examples directory of therepository](https://github.com/spicavigo/kafka-rust/tree/master/examples).
5170

5271
##Consumer
5372

@@ -57,16 +76,14 @@ support on behalf of a specified group. This is the API a client
5776
application of this library wants to use for receiving messages from
5877
Kafka.
5978

60-
6179
##Producer
6280

6381
This is a higher-level producer API for Kafka and is provided by the
6482
module`kafka::producer`. It provides convenient automatic partition
6583
assignment capabilities through partitioners. This is the API a
66-
client application of this library wants to use for sendingmesssages
84+
client application of this library wants to use for sendingmessages
6785
to Kafka.
6886

69-
7087
##KafkaClient
7188

7289
`KafkaClient` in the`kafka::client` module is the central point of
@@ -75,13 +92,12 @@ suitable for building higher-level APIs. Applications typically want
7592
to use the already mentioned`Consumer` and`Producer`.
7693
Nevertheless, the main features or`KafkaClient` are:
7794

78-
* Loading metadata
79-
* Fetching topic offsets
80-
* Sending messages
81-
* Fetching messages
82-
* Committing a consumer group's offsets
83-
* Fetching a consumer group's offsets
84-
95+
- Loading metadata
96+
- Fetching topic offsets
97+
- Sending messages
98+
- Fetching messages
99+
- Committing a consumer group's offsets
100+
- Fetching a consumer group's offsets
85101

86102
##Bugs / Features / Contributing
87103

@@ -103,7 +119,6 @@ Docker (1.10.0+) and docker-compose (1.6.0+) installed and run the tests via the
103119
included`run-all-tests` script in the`tests` directory. See the`run-all-tests`
104120
script itself for details on its usage.
105121

106-
107122
##Creating a topic
108123

109124
Note unless otherwise explicitly stated in the documentation, this
@@ -125,5 +140,5 @@ for more information.
125140

126141
##Alternative/Related projects
127142

128-
*[rust-rdkafka](https://github.com/fede1024/rust-rdkafka) is an emerging alternative Kafka client library for Rust based on
129-
`librdkafka`. rust-rdkafka provides a safe Rust interface to librdkafka.
143+
-[rust-rdkafka](https://github.com/fede1024/rust-rdkafka) is an emerging alternative Kafka client library for Rust based on
144+
`librdkafka`. rust-rdkafka provides a safe Rust interface to librdkafka.

‎deny.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[licenses]
2+
allow = ["MIT","Apache-2.0","BSD-3-Clause"]

‎dprint.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"json": {
3+
},
4+
"markdown": {
5+
},
6+
"toml": {
7+
},
8+
"includes": ["**/*.{json,md,toml}"],
9+
"excludes": [
10+
"/target"
11+
],
12+
"plugins": [
13+
"https://plugins.dprint.dev/json-0.15.2.wasm",
14+
"https://plugins.dprint.dev/markdown-0.13.2.wasm",
15+
"https://plugins.dprint.dev/toml-0.5.4.wasm"
16+
]
17+
}

‎examples/console-consumer.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ impl Config {
8989
let args:Vec<_> = env::args().collect();
9090
letmut opts = getopts::Options::new();
9191
opts.optflag("h","help","Print this help screen");
92-
opts.optopt("","brokers","Specify kafka brokers (comma separated)","HOSTS");
92+
opts.optopt(
93+
"",
94+
"brokers",
95+
"Specify kafka brokers (comma separated)",
96+
"HOSTS",
97+
);
9398
opts.optopt("","topics","Specify topics (comma separated)","NAMES");
9499
opts.optopt("","group","Specify the consumer group","NAME");
100+
95101
opts.optflag("","commit","Commit group offsets");
96102
opts.optopt("","storage","Specify the offset store [zookeeper, kafka]","STORE");
103+
97104
opts.optflag(
98105
"",
99106
"earliest",

‎examples/console-producer.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,20 @@ impl Config {
186186
let args:Vec<String> = env::args().collect();
187187
letmut opts = getopts::Options::new();
188188
opts.optflag("h","help","Print this help screen");
189-
opts.optopt("","brokers","Specify kafka brokers (comma separated)","HOSTS");
189+
opts.optopt(
190+
"",
191+
"brokers",
192+
"Specify kafka brokers (comma separated)",
193+
"HOSTS",
194+
);
190195
opts.optopt("","topic","Specify target topic","NAME");
191196
opts.optopt("","input","Specify input file","FILE");
192-
opts.optopt("","compression","Compress messages [NONE, GZIP, SNAPPY]","TYPE");
197+
opts.optopt(
198+
"",
199+
"compression",
200+
"Compress messages [NONE, GZIP, SNAPPY]",
201+
"TYPE",
202+
);
193203
opts.optopt(
194204
"",
195205
"required-acks",
@@ -198,7 +208,12 @@ impl Config {
198208
);
199209
opts.optopt("","ack-timeout","Specify time to wait for acks","MILLIS");
200210
opts.optopt("","batch-size","Send N message in one batch.","N");
201-
opts.optopt("","idle-timeout","Specify timeout for idle connections","MILLIS");
211+
opts.optopt(
212+
"",
213+
"idle-timeout",
214+
"Specify timeout for idle connections",
215+
"MILLIS",
216+
);
202217

203218
macro_rules! on_error{
204219
($name:expr) =>{{
@@ -244,7 +259,10 @@ impl Config {
244259
Some(ref s)if s.eq_ignore_ascii_case("one") =>RequiredAcks::One,
245260
Some(ref s)if s.eq_ignore_ascii_case("all") =>RequiredAcks::All,
246261
Some(s) =>{
247-
returnErr(anyhow!("{:?}", format!("Unknown --required-acks argument: {}", s)))
262+
returnErr(anyhow!(
263+
"{:?}",
264+
format!("Unknown --required-acks argument: {}", s)
265+
))
248266
}
249267
},
250268
batch_size:to_number(m.opt_str("batch-size"),1)?,

‎examples/example-consume.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use kafka::error::Error as KafkaError;
33

44
/// This program demonstrates consuming messages through a `Consumer`.
55
/// This is a convenient client that will fit most use cases. Note
6-
/// that messages must be marked andcommited as consumed to ensure
6+
/// that messages must be marked andcommitted as consumed to ensure
77
/// only once delivery.
88
fnmain(){
99
tracing_subscriber::fmt::init();
@@ -34,7 +34,13 @@ fn consume_messages(group: String, topic: String, brokers: Vec<String>) -> Resul
3434

3535
for msin mss.iter(){
3636
for min ms.messages(){
37-
println!("{}:{}@{}: {:?}", ms.topic(), ms.partition(), m.offset, m.value);
37+
println!(
38+
"{}:{}@{}: {:?}",
39+
ms.topic(),
40+
ms.partition(),
41+
m.offset,
42+
m.value
43+
);
3844
}
3945
let _ = con.consume_messageset(ms);
4046
}

‎examples/example-ssl.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,20 @@ mod example {
116116
fnfrom_cmdline() ->Result<Config,String>{
117117
letmut opts = getopts::Options::new();
118118
opts.optflag("h","help","Print this help screen");
119-
opts.optopt("","brokers","Specify kafka brokers (comma separated)","HOSTS");
119+
opts.optopt(
120+
"",
121+
"brokers",
122+
"Specify kafka brokers (comma separated)",
123+
"HOSTS",
124+
);
120125
opts.optopt("","ca-cert","Specify the trusted CA certificates","FILE");
121126
opts.optopt("","client-cert","Specify the client certificate","FILE");
122-
opts.optopt("","client-key","Specify key for the client certificate","FILE");
127+
opts.optopt(
128+
"",
129+
"client-key",
130+
"Specify key for the client certificate",
131+
"FILE",
132+
);
123133
opts.optflag(
124134
"",
125135
"no-hostname-verification",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp