Skip to content

Commit

Permalink
chore: add explanation for consumer.recv().now_or_never() in examples (
Browse files Browse the repository at this point in the history
…#4)

* add explaination comments

* fmt

* refine

* refine

* fix

* fix
  • Loading branch information
yuhao-su authored Oct 17, 2024
1 parent 82eb852 commit a6efa88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ async fn main() {

let consumer: StreamConsumer<IamConsumerContext> = config.create_with_context(context).unwrap();

// Uncomment the following code to get the partition list and assign the partitions to the consumer.
//
// Please note that it's necessary to call `consumer.recv().now_or_never()` to refresh the OAUTHBEARER token
// before calling `consumer.fetch_metadata()` here.
//
// > Note that before any SASL/OAUTHBEARER broker connection can succeed the application must call rd_kafka_oauthbearer_set_token()
// > once – either directly or, more typically, by invoking either rd_kafka_poll(), rd_kafka_consumer_poll(), rd_kafka_queue_poll(),
// > etc, in order to cause retrieval of an initial token to occur.
// See https://docs.confluent.io/platform/current/clients/librdkafka/html/rdkafka_8h.html#a988395722598f63396d7a1bedb22adaf
// for details.
//
// assert!(consumer.recv().now_or_never().is_none());
// let partition_list = {
// let mut list = TopicPartitionList::new();
Expand Down

0 comments on commit a6efa88

Please sign in to comment.