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

Commitaf3b346

Browse files
committed
Merge branch 'midnightexigent-master'
Formatting, dependency upgrade, and some niceties
2 parentsecb2a00 +ed09c00 commitaf3b346

37 files changed

+784
-524
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: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
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]
29-
getopts ="0.2.21"
29+
anyhow ="1.0.57"
3030
env_logger ="0.9.0"
31-
time ="0.3.7"
32-
rand ="0.8.5"
31+
getopts ="0.2.21"
3332
lazy_static ="1.4.0"
34-
anyhow ="1.0.55"
35-
log ="0.4.16"
33+
log ="0.4.17"
34+
rand ="0.8.5"
35+
time ="0.3.9"
3636

3737
[features]
3838
default = ["snappy","gzip","security"]

‎README.md

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ 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

2018
##Sponsors
21-
Thank you to our sponsers, this helps me to spend more time on this project and also helps with infrastructure
19+
20+
Thank you to our sponsors, this helps me to spend more time on this project and also helps with infrastructure
2221

2322
<table>
2423
<tr>
@@ -30,13 +29,14 @@ Thank you to our sponsers, this helps me to spend more time on this project and
3029

3130
<h3>Upstash: Serverless Kafka</h3>
3231

33-
<ul>
32+
<ul>
3433
<li>True Serverless Kafka with per-request-pricing</li>
3534
<li>Managed Apache Kafka, works with all Kafka clients</li>
3635
<li>Built-in REST API designed for serverless and edge functions</li>
3736
</ul>
3837

39-
[Start for free in 30 seconds!](https://upstash.com/?utm_source=kafka-rust")
38+
[Start for free in 30 seconds!](https://upstash.com/?utm_source=kafka-rust)
39+
4040
</td>
4141
</tr>
4242
</table>
@@ -55,8 +55,7 @@ kafka = "0.9"
5555

5656
To build kafka-rust the usual`cargo build` should suffice. The crate
5757
supports various features which can be turned off at compile time.
58-
See kafka-rust's`Cargo.toml` and[cargo's
59-
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).
6059

6160
##Supported Kafka version
6261

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

6665
##Examples
6766

68-
As mentioned, the[cargo generated
69-
documentation](https://docs.rs/kafka/) contains some examples.
67+
As mentioned, the[cargo generateddocumentation](https://docs.rs/kafka/) contains some examples.
7068
Further, standalone, compilable example programs are provided in the
71-
[examples directory of the
72-
repository](https://github.com/spicavigo/kafka-rust/tree/master/examples).
73-
69+
[examples directory of therepository](https://github.com/spicavigo/kafka-rust/tree/master/examples).
7470

7571
##Consumer
7672

@@ -80,16 +76,14 @@ support on behalf of a specified group. This is the API a client
8076
application of this library wants to use for receiving messages from
8177
Kafka.
8278

83-
8479
##Producer
8580

8681
This is a higher-level producer API for Kafka and is provided by the
8782
module`kafka::producer`. It provides convenient automatic partition
8883
assignment capabilities through partitioners. This is the API a
89-
client application of this library wants to use for sendingmesssages
84+
client application of this library wants to use for sendingmessages
9085
to Kafka.
9186

92-
9387
##KafkaClient
9488

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

101-
* Loading metadata
102-
* Fetching topic offsets
103-
* Sending messages
104-
* Fetching messages
105-
* Committing a consumer group's offsets
106-
* Fetching a consumer group's offsets
107-
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
108101

109102
##Bugs / Features / Contributing
110103

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

129-
130122
##Creating a topic
131123

132124
Note unless otherwise explicitly stated in the documentation, this
@@ -148,5 +140,5 @@ for more information.
148140

149141
##Alternative/Related projects
150142

151-
*[rust-rdkafka](https://github.com/fede1024/rust-rdkafka) is an emerging alternative Kafka client library for Rust based on
143+
-[rust-rdkafka](https://github.com/fede1024/rust-rdkafka) is an emerging alternative Kafka client library for Rust based on
152144
`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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,21 @@ impl Config {
9090
let args:Vec<_> = env::args().collect();
9191
letmut opts = getopts::Options::new();
9292
opts.optflag("h","help","Print this help screen");
93-
opts.optopt("","brokers","Specify kafka brokers (comma separated)","HOSTS");
93+
opts.optopt(
94+
"",
95+
"brokers",
96+
"Specify kafka brokers (comma separated)",
97+
"HOSTS",
98+
);
9499
opts.optopt("","topics","Specify topics (comma separated)","NAMES");
95100
opts.optopt("","group","Specify the consumer group","NAME");
96101
opts.optflag("","no-commit","Do not commit group offsets");
97-
opts.optopt("","storage","Specify the offset store [zookeeper, kafka]","STORE");
102+
opts.optopt(
103+
"",
104+
"storage",
105+
"Specify the offset store [zookeeper, kafka]",
106+
"STORE",
107+
);
98108
opts.optflag(
99109
"",
100110
"earliest",

‎examples/console-producer.rs

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

204219
let m =match opts.parse(&args[1..]){
205220
Ok(m) => m,
@@ -238,7 +253,10 @@ impl Config {
238253
Some(ref s)if s.eq_ignore_ascii_case("one") =>RequiredAcks::One,
239254
Some(ref s)if s.eq_ignore_ascii_case("all") =>RequiredAcks::All,
240255
Some(s) =>{
241-
returnErr(anyhow!("{:?}", format!("Unknown --required-acks argument: {}", s)))
256+
returnErr(anyhow!(
257+
"{:?}",
258+
format!("Unknown --required-acks argument: {}", s)
259+
))
242260
}
243261
},
244262
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
env_logger::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
@@ -118,10 +118,20 @@ mod example {
118118
fnfrom_cmdline() ->Result<Config,String>{
119119
letmut opts = getopts::Options::new();
120120
opts.optflag("h","help","Print this help screen");
121-
opts.optopt("","brokers","Specify kafka brokers (comma separated)","HOSTS");
121+
opts.optopt(
122+
"",
123+
"brokers",
124+
"Specify kafka brokers (comma separated)",
125+
"HOSTS",
126+
);
122127
opts.optopt("","ca-cert","Specify the trusted CA certificates","FILE");
123128
opts.optopt("","client-cert","Specify the client certificate","FILE");
124-
opts.optopt("","client-key","Specify key for the client certificate","FILE");
129+
opts.optopt(
130+
"",
131+
"client-key",
132+
"Specify key for the client certificate",
133+
"FILE",
134+
);
125135
opts.optflag(
126136
"",
127137
"no-hostname-verification",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp