1 个不稳定版本
0.1.0 | 2022 年 3 月 19 日 |
---|
#9 in #rdkafka
6KB
98 行代码(不含注释)
#SBKafka
轻松消费 rdkafka
导入
use {
sbkafka::{subscribe,publisher}
};
消费
let consume = subscribe;
let _producer = publisher(&args);
consume(&args,&process_msg).await;
where process_msg 是
fn process_msg(message:&BorrowedMessage) {
let payload = message
.payload_view::<str>()
.unwrap_or(Ok(""))
.unwrap_or_else(|e| {
error!("Error while deserializing payload: {:?}", e);
""
});
}
生产
let producer = publisher(&args);
依赖项
~18–29MB
~372K SLoC