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

Commit4a73098

Browse files
authored
Merge branch 'master' into list-offsets
2 parents3a9c44c +d8f001f commit4a73098

31 files changed

+523
-362
lines changed

‎.github/workflows/rust.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name:Rust
2+
3+
on:
4+
push:
5+
branches:[ "main", "master" ]
6+
pull_request:
7+
branches:[ "main", "master" ]
8+
9+
env:
10+
CARGO_TERM_COLOR:always
11+
RUST_TEST_THREADS:1
12+
DOCKER_HUB_USER:${{ secrets.DOCKER_HUB_USER }}
13+
DOCKER_HUB_TOKEN:${{ secrets.DOCKER_HUB_TOKEN }}
14+
15+
jobs:
16+
test:
17+
runs-on:ubuntu-latest
18+
strategy:
19+
matrix:
20+
include:
21+
-KAFKA_VER:3.4.0
22+
COMPRESSIONS:NONE
23+
SECURES:""
24+
-KAFKA_VER:3.4.0
25+
COMPRESSIONS:NONE
26+
SECURES:secure
27+
-KAFKA_VER:3.4.0
28+
COMPRESSIONS:SNAPPY
29+
SECURES:""
30+
-KAFKA_VER:3.4.0
31+
COMPRESSIONS:SNAPPY
32+
SECURES:secure
33+
-KAFKA_VER:3.4.0
34+
COMPRESSIONS:GZIP
35+
SECURES:""
36+
-KAFKA_VER:3.4.0
37+
COMPRESSIONS:GZIP
38+
SECURES:secure
39+
-KAFKA_VER:3.8.0
40+
COMPRESSIONS:NONE
41+
SECURES:""
42+
-KAFKA_VER:3.8.0
43+
COMPRESSIONS:NONE
44+
SECURES:secure
45+
-KAFKA_VER:3.8.0
46+
COMPRESSIONS:SNAPPY
47+
SECURES:""
48+
-KAFKA_VER:3.8.0
49+
COMPRESSIONS:SNAPPY
50+
SECURES:secure
51+
-KAFKA_VER:3.8.0
52+
COMPRESSIONS:GZIP
53+
SECURES:""
54+
-KAFKA_VER:3.8.0
55+
COMPRESSIONS:GZIP
56+
SECURES:secure
57+
steps:
58+
-uses:actions/checkout@v4
59+
-name:Login to Docker Hub
60+
run:echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USER }}" --password-stdin
61+
62+
-name:Set up Rust
63+
uses:actions-rs/toolchain@v1
64+
with:
65+
profile:minimal
66+
toolchain:stable
67+
68+
-name:Build
69+
run:cargo build
70+
71+
-name:Run tests
72+
run:./tests/run-all-tests ${{ matrix.KAFKA_VER }}
73+
env:
74+
KAFKA_VER:${{ matrix.KAFKA_VER }}
75+
COMPRESSIONS:${{ matrix.COMPRESSIONS }}
76+
SECURES:${{ matrix.SECURES }}
77+
78+
-name:Generate documentation
79+
run:cargo doc

‎.travis.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

‎Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ repository = "https://github.com/kafka-rust/kafka-rust"
1212
description ="Rust client for Apache Kafka"
1313

1414
[dependencies]
15-
byteorder ="1.4.3"
16-
crc ="3.0.0"
15+
byteorder ="1.5"
16+
crc ="3.2"
1717
fnv ="1.0.7"
1818
ref_slice ="1.2.1"
1919
twox-hash ="1.6.3"
2020

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 }
24-
snap = {version ="1.0.5",optional =true }
25-
thiserror ="1.0.31"
26-
tracing ="0.1.34"
21+
flate2 = {version ="1.0",optional =true }
22+
openssl = {version ="0.10",optional =true }
23+
openssl-sys = {version ="0.9",optional =true }
24+
snap = {version ="1.1",optional =true }
25+
thiserror ="1.0"
26+
tracing ="0.1"
2727

2828
[dev-dependencies]
2929
getopts ="0.2.21"
3030
tracing-subscriber ="0.3"
31-
time ="0.3.7"
31+
time ="0.3"
3232
rand ="0.8.5"
33-
lazy_static ="1.4.0"
34-
anyhow ="1.0.55"
33+
lazy_static ="1.5"
34+
anyhow ="1.0"
3535

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

‎README.md

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#Kafka Rust Client
22

3-
[![Build Status](https://travis-ci.org/spicavigo/kafka-rust.svg?branch=master)](https://travis-ci.org/spicavigo/kafka-rust)[![](http://meritbadge.herokuapp.com/kafka)](https://crates.io/crates/kafka)
4-
53
##Project Status
64

75
This project is starting to be maintained by John Ward, the current status is that I am bringing the project up to date with the latest dependencies, removing deprecated Rust code and adjusting the tests.
@@ -15,32 +13,6 @@ Welcome to kafka-rust's new home: https://github.com/kafka-rust
1513
- This library is primarily documented through examples in its[API documentation](https://docs.rs/kafka/).
1614
- Documentation about Kafka itself can be found at[its project home page](http://kafka.apache.org/).
1715

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>
43-
4416
##Installation
4517

4618
This crate works with Cargo and is on
@@ -50,7 +22,7 @@ expect the version number to grow quickly).
5022

5123
```toml
5224
[dependencies]
53-
kafka ="0.9"
25+
kafka ="0.10"
5426
```
5527

5628
To build kafka-rust the usual`cargo build` should suffice. The crate
@@ -135,6 +107,12 @@ distribution):
135107
kafka-topics.sh --topic my-topic --create --zookeeper localhost:2181 --partitions 1 --replication-factor 1
136108
```
137109

110+
Zookeeper will be removed in the next major kafka release. Using`--bootstrap-server` to be more ready.
111+
112+
```
113+
kafka-topics.sh --topic my-topic --create --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
114+
```
115+
138116
See also[Kafka's quickstart guide](https://kafka.apache.org/documentation.html#quickstart)
139117
for more information.
140118

‎examples/console-consumer.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ fn main() {
2121
process::exit(1);
2222
}
2323
};
24-
info!("Starting consumer with the following configuration: {:?}", cfg);
24+
info!(
25+
"Starting consumer with the following configuration: {:?}",
26+
cfg
27+
);
2528

2629
ifletErr(e) =process(cfg){
2730
error!("{}", e);
@@ -51,7 +54,7 @@ fn process(cfg: Config) -> Result<()> {
5154
letmut buf =Vec::with_capacity(1024);
5255

5356
loop{
54-
for msin c.poll().unwrap().iter(){
57+
for msin c.poll().unwrap().into_iter(){
5558
for min ms.messages(){
5659
// ~ clear the output buffer
5760
unsafe{ buf.set_len(0)};
@@ -62,7 +65,7 @@ fn process(cfg: Config) -> Result<()> {
6265
// ~ write to output channel
6366
stdout.write_all(&buf)?;
6467
}
65-
let _ = c.consume_messageset(ms);
68+
let _ = c.consume_messageset(&ms);
6669
}
6770
if cfg.commit{
6871
c.commit_consumed()?;
@@ -99,7 +102,12 @@ impl Config {
99102
opts.optopt("","group","Specify the consumer group","NAME");
100103

101104
opts.optflag("","commit","Commit group offsets");
102-
opts.optopt("","storage","Specify the offset store [zookeeper, kafka]","STORE");
105+
opts.optopt(
106+
"",
107+
"storage",
108+
"Specify the offset store [zookeeper, kafka]",
109+
"STORE",
110+
);
103111

104112
opts.optflag(
105113
"",
@@ -122,7 +130,10 @@ impl Config {
122130
let m =match opts.parse(&args[1..]){
123131
Ok(m) => m,
124132
Err(e) =>{
125-
on_error!(format!("argument parsing encountered an error: {}", e.to_string()))
133+
on_error!(format!(
134+
"argument parsing encountered an error: {}",
135+
e.to_string()
136+
))
126137
}
127138
};
128139
if m.opt_present("help"){

‎examples/example-consume.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn consume_messages(group: String, topic: String, brokers: Vec<String>) -> Resul
3232
returnOk(());
3333
}
3434

35-
for msin mss.iter(){
35+
for msin mss.into_iter(){
3636
for min ms.messages(){
3737
println!(
3838
"{}:{}@{}: {:?}",
@@ -42,7 +42,7 @@ fn consume_messages(group: String, topic: String, brokers: Vec<String>) -> Resul
4242
m.value
4343
);
4444
}
45-
let _ = con.consume_messageset(ms);
45+
let _ = con.consume_messageset(&ms);
4646
}
4747
con.commit_consumed()?;
4848
}

‎kafka-rust-image.png

-22.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp