Giter Club home page Giter Club logo

rust-rdkafka's Introduction

rust-rdkafka

crates.io docs.rs Build Status coverate Join the chat at https://gitter.im/rust-rdkafka/Lobby

A fully asynchronous, futures-enabled Apache Kafka client library for Rust based on librdkafka.

The library

rust-rdkafka provides a safe Rust interface to librdkafka. This version is compatible with librdkafka v1.9.2+.

Documentation

Features

The main features provided at the moment are:

  • Support for all Kafka versions since 0.8.x. For more information about broker compatibility options, check the librdkafka documentation.
  • Consume from single or multiple topics.
  • Automatic consumer rebalancing.
  • Customizable rebalance, with pre and post rebalance callbacks.
  • Synchronous or asynchronous message production.
  • Customizable offset commit.
  • Create and delete topics and add and edit partitions.
  • Alter broker and topic configurations.
  • Access to cluster metadata (list of topic-partitions, replicas, active brokers etc).
  • Access to group metadata (list groups, list members of groups, hostnames, etc.).
  • Access to producer and consumer metrics, errors and callbacks.
  • Exactly-once semantics (EOS) via idempotent and transactional producers and read-committed consumers.

One million messages per second

rust-rdkafka is designed to be easy and safe to use thanks to the abstraction layer written in Rust, while at the same time being extremely fast thanks to the librdkafka C library.

Here are some benchmark results using the BaseProducer, sending data to a single Kafka 0.11 process running in localhost (default configuration, 3 partitions). Hardware: Dell laptop, with Intel Core i7-4712HQ @ 2.30GHz.

  • Scenario: produce 5 million messages, 10 bytes each, wait for all of them to be acked

    • 1045413 messages/s, 9.970 MB/s (average over 5 runs)
  • Scenario: produce 100000 messages, 10 KB each, wait for all of them to be acked

    • 24623 messages/s, 234.826 MB/s (average over 5 runs)

For more numbers, check out the kafka-benchmark project.

Client types

rust-rdkafka provides low level and high level consumers and producers.

Low level:

  • BaseConsumer: a simple wrapper around the librdkafka consumer. It must be periodically poll()ed in order to execute callbacks, rebalances and to receive messages.
  • BaseProducer: a simple wrapper around the librdkafka producer. As in the consumer case, the user must call poll() periodically to execute delivery callbacks.
  • ThreadedProducer: a BaseProducer with a separate thread dedicated to polling the producer.

High level:

For more information about consumers and producers, refer to their module-level documentation.

Warning: the library is under active development and the APIs are likely to change.

Asynchronous data processing with Tokio

Tokio is a platform for fast processing of asynchronous events in Rust. The interfaces exposed by the StreamConsumer and the FutureProducer allow rust-rdkafka users to easily integrate Kafka consumers and producers within the Tokio platform, and write asynchronous message processing code. Note that rust-rdkafka can be used without Tokio.

To see rust-rdkafka in action with Tokio, check out the asynchronous processing example in the examples folder.

At-least-once delivery

At-least-once delivery semantics are common in many streaming applications: every message is guaranteed to be processed at least once; in case of temporary failure, the message can be re-processed and/or re-delivered, but no message will be lost.

In order to implement at-least-once delivery the stream processing application has to carefully commit the offset only once the message has been processed. Committing the offset too early, instead, might cause message loss, since upon recovery the consumer will start from the next message, skipping the one where the failure occurred.

To see how to implement at-least-once delivery with rdkafka, check out the at-least-once delivery example in the examples folder. To know more about delivery semantics, check the message delivery semantics chapter in the Kafka documentation.

Exactly-once semantics

Exactly-once semantics (EOS) can be achieved using transactional producers, which allow produced records and consumer offsets to be committed or aborted atomically. Consumers that set their isolation.level to read_committed will only observe committed messages.

EOS is useful in read-process-write scenarios that require messages to be processed exactly once.

To learn more about using transactions in rust-rdkafka, see the Transactions section of the producer documentation.

Users

Here are some of the projects using rust-rdkafka:

  • timely-dataflow: a distributed data-parallel compute engine. See also the blog post announcing its Kafka integration.
  • kafka-view: a web interface for Kafka clusters.
  • kafka-benchmark: a high performance benchmarking tool for Kafka.
  • callysto: Stream processing framework in Rust.
  • bytewax: Python stream processing framework using Timely Dataflow.

If you are using rust-rdkafka, please let us know!

Installation

Add this to your Cargo.toml:

[dependencies]
rdkafka = { version = "0.25", features = ["cmake-build"] }

This crate will compile librdkafka from sources and link it statically to your executable. To compile librdkafka you'll need:

  • the GNU toolchain
  • GNU make
  • pthreads
  • zlib: optional, but included by default (feature: libz)
  • cmake: optional, not included by default (feature: cmake-build)
  • libssl-dev: optional, not included by default (feature: ssl)
  • libsasl2-dev: optional, not included by default (feature: gssapi)
  • libzstd-dev: optional, not included by default (feature: zstd-pkg-config)

Note that using the CMake build system, via the cmake-build feature, is encouraged if you can take the dependency on CMake.

By default a submodule with the librdkafka sources pinned to a specific commit will be used to compile and statically link the library. The dynamic-linking feature can be used to instead dynamically link rdkafka to the system's version of librdkafka. Example:

[dependencies]
rdkafka = { version = "0.25", features = ["dynamic-linking"] }

For a full listing of features, consult the rdkafka-sys crate's documentation. All of rdkafka-sys features are re-exported as rdkafka features.

Minimum supported Rust version (MSRV)

The current minimum supported Rust version (MSRV) is 1.61.0. Note that bumping the MSRV is not considered a breaking change. Any release of rust-rdkafka may bump the MSRV.

Asynchronous runtimes

Some features of the StreamConsumer and FutureProducer depend on Tokio, which can be a heavyweight dependency for users who only intend to use the low-level consumers and producers. The Tokio integration is enabled by default, but can be disabled by turning off default features:

[dependencies]
rdkafka = { version = "0.25", default-features = false }

If you would like to use an asynchronous runtime besides Tokio, you can integrate it with rust-rdkafka by providing a shim that implements the AsyncRuntime trait. See the following examples for details:

Examples

You can find examples in the examples folder. To run them:

cargo run --example <example_name> -- <example_args>

Debugging

rust-rdkafka uses the log crate to handle logging. Optionally, enable the tracing feature to emit tracing events as opposed to log records.

In test and examples, rust-rdkafka uses the env_logger crate to format logs. In those contexts, logging can be enabled using the RUST_LOG environment variable, for example:

RUST_LOG="librdkafka=trace,rdkafka::client=debug" cargo test

This will configure the logging level of librdkafka to trace, and the level of the client module of the Rust client to debug. To actually receive logs from librdkafka, you also have to set the debug option in the producer or consumer configuration (see librdkafka configuration).

To enable debugging in your project, make sure you initialize the logger with env_logger::init(), or the equivalent for any log-compatible logging framework.

rdkafka-sys

See rdkafka-sys.

Contributors

Thanks to:

Alternatives

  • kafka-rust: a pure Rust implementation of the Kafka client.

rust-rdkafka's People

Contributors

a-rodin1 avatar abolibibelot avatar benesch avatar clementtsang avatar davidblewett avatar dependabot[bot] avatar emilk avatar fede1024 avatar flavray avatar gklijs avatar gregbowyer avatar guswynn avatar ilya-epifanov avatar licenser avatar loewenheim avatar mborst avatar messense avatar mlowicki avatar qbx2 avatar roignpar avatar scanterog avatar sphw avatar sreeniio avatar ten0 avatar thijsc avatar tshepang avatar vertexclique avatar vojtechkral avatar vorner avatar wrl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-rdkafka's Issues

Some of the examples don't compile

The at_least_once.rs example does not compile due to a dependency on rdkafka::client::ClientContext, which appears to no longer exist and FutureProducer is now parametric, but the usage of FutureProducer in the example code does not provide parameter.

Rebalance &mut ?

Hello! I am trying to force the topic offset to Offset::Beginning by defining my own ConsumerContext to handle the rebalance callback. I am following this librdkafka example, combined with rust-rdkafka's API. My code looks like this :

#[derive(Clone)]
pub struct ReloadContext;
impl Context for ReloadContext {}
impl ConsumerContext for ReloadContext {
    /// Override topic offset to beginning, always
    fn pre_rebalance<'a>(&self, rebalance: &Rebalance<'a>) {
        if let &Rebalance::Assign(tpl) = rebalance {
            tpl.set_all_offsets(Offset::Beginning);
        }
    }
}

But this does not work, since set_all_offset requires an &mut tpl while ConsumerContext::pre_rebalance() only gets a read ref. Looking at the lib code, it seems Rebalance::Assign()should be passed an &mut TopicPartitionList.

Am I missing something (or is there a simpler way to do what I want)?

โ€žRustificationโ€œ of the API

Hello

When using the library, I have somewhat non-rusty feeling from the API. To highlight some (this is not exhaustive):

  • The ClientConfig::set that takes two string arguments and panics at runtime if it is wrong could be done with an enum, eg. .set(ConfigValue::BootstrapServers(&["srv1", "srv2"])) โ€’ which would ensure that the option is valid and has the right type at compile time.
  • The consumer could provide an iterator API to just read the messages, without caring too much about what timed out, etc.
  • The numeric parameter to consumer.poll is error-prone. The better way would be to use a Option<Duration> as the parameter (with None meaning no timeout).

I understand this is what the wrapped library provides and that it would take extra work to provide rust-native API. What I want to ask is if there's another reason for it.

In other words, if I started sending PRs that change the API to look more rust-like, would you be willing to accept them (provided they satisfy needed quality requirements), or would it be against the goal of the library?

mention how to statically link in the docs?

The change to dynamically link librdkafka caused me some issues today, and it took me a while of reading through pkg-config-rs documentation to figure out that if I set the environment variable RDKAFKA_NO_PKG_CONFIG=1 before running cargo build, rdkafka-sys would build the embedded static copy.

This may be worth mentioning somewhere in the rust-rdkafka documentation?

Integration tests

We currently have very simple integration test suite that cover a small subset of the library functionality.

We should have a Docker container based Kafka cluster, and run a series of integration tests on it. Ideally, all tests should run inside valgrind, to spot any eventual memory issue. All the tests should be executed automatically by Travis.

  • Integration tests for StreamConsumer
  • Integration tests for FutureProducer
  • Integration tests for BaseConsumer
  • Integration tests for BaseProducer
  • Integration tests for Metadata fetch
  • Integration tests for Subscription
  • Run integration tests in Docker container
  • Run all tests inside Valgrind and analyze errors automatically
  • Run integration tests in travis
  • Run integration tests against multiple Kafka versions

Documentation/README

This looks like a very promising library! Is there any chance to give it a README with some basic information, one shot example, and links to autogenerated documentation? May a link to the documentation provided by docs.rs would suffice.

[Question] Dynamic linking doesn't emit link args to rustc from build.rs?

Heya Federico, hope things are going well :)

I was wondering for the dynamic linking option how the build script works without emitting cargo:rustc-link-lib=<library> (e.g. cargo build scripts docs). Is there something special happening via the pkg-config probe?

Just curious because I'm dealing with some dynamic system library linking myself and was wondering what blackmagic you knew and whether you'd be willing to teach it!

Achieving committing offsets only after successful productions

I've got myself worked into a corner and I'm not sure how to work back out with the API as-is. I could use a little guidance. My basic ambition is laid out in an issue on the python client. That is, I'd like to write a process that reads from some input topic and writes an an output topic and commits offsets to input only if the record has been successfully produced to output.

As of 0.17, rdkafka's ProducerContext::delivery is called with a DeliveryResult that contains a BorrowedMessage to the record published to output and not the BorrowedMessage which came in from input. But, Consumer::store_offset requires a &BorrowedMessage be passed, the same that came in from the Consumer.

Okay, so I have to get the original &BorrowedMessage through to ProducerContext::delivery along with a reference to the Consumer to accomplish my aim, I think. It occurred to me that I might pass a (&BorrowedMessage, &Consumer) through as a ProducerContext::DeliveryOpaque but that seems excessively complicated. Not to mention, there will need to be a rectification layer in there somewhere so that offsets are only committed in-order. I'm really not sure how to fit that in.

I noticed that examples/at_least_once.rs accomplishes this by auto-committing explicitly stored offsets but waits synchronously for produced records to signal back with success. This is close to what I'd like to accomplish but the throughput is a little disappointing, what with the serialization on every production.

I guess, is there a more throughput oriented way to commit consumed offsets only after records that result from them have been successfully produced other than serializing on writes? It feels like there's something close with ProducerContext::delivery but I'm not quite finding it.

Fails to link with the sasl feature

Hello

If I enable the ssl and sasl features, I get this linker error:

...oolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9800ad35a81c8987.rlib" "-Wl,-Bdynamic" "-l" "z" "-l" "ssl" "-l" "crypto" "-l" "util" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util"
  = note: /home/vorner/work/sky/skygazer/target/release/deps/librdkafka_sys-5ffa034776944838.rlib(rdkafka_sasl_cyrus.o): In function `rd_kafka_sasl_cyrus_close':
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:409: undefined reference to `sasl_dispose'
          /home/vorner/work/sky/skygazer/target/release/deps/librdkafka_sys-5ffa034776944838.rlib(rdkafka_sasl_cyrus.o): In function `rd_kafka_sasl_cyrus_recv':
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:74: undefined reference to `sasl_client_step'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:100: undefined reference to `sasl_errdetail'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:112: undefined reference to `sasl_getprop'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:116: undefined reference to `sasl_getprop'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:120: undefined reference to `sasl_getprop'
          /home/vorner/work/sky/skygazer/target/release/deps/librdkafka_sys-5ffa034776944838.rlib(rdkafka_sasl_cyrus.o): In function `rd_kafka_sasl_cyrus_client_new':
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:462: undefined reference to `sasl_client_new'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:484: undefined reference to `sasl_client_start'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:502: undefined reference to `sasl_errdetail'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:473: undefined reference to `sasl_listmech'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:466: undefined reference to `sasl_errstring'
          /home/vorner/work/sky/skygazer/target/release/deps/librdkafka_sys-5ffa034776944838.rlib(rdkafka_sasl_cyrus.o): In function `rd_kafka_sasl_cyrus_global_init':
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:604: undefined reference to `sasl_client_init'
          /home/vorner/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.3-0/librdkafka/src/rdkafka_sasl_cyrus.c:606: undefined reference to `sasl_errstring'
          collect2: error: ld returned 1 exit status

My guess is it tries to use sasl, but there's no -l for it on the command line.

Subscribing to a non existing topic silently kills the consumer

When subscribing to a topic that doesn't exist will silently kill the consumer.

When calling subscribe on a stream consumer with at least one of the topics not existing on kafka the consumer as a whole will not receive messages. The subscribe call will not return an error either.

tokio, streaming consumer, future producer leading to `rd.h:298: rd_refcnt_sub0: Assertion `!*"refcnt sub-zero"' failed.`

Environment:

  • Five (5) brokers running Kafka 0.9.0.1
  • rust-rdkafka version 0.13.0

Code:

This is approximate, not a direct copy and paste, trying to keep it concise and to the point. If i need to clarify how/where stuff is coming from let me know.

// lots of extern crates here
extern crate tokio_core

// lots of use calls here
use tokio_core::reactor::Core;

fn main():
  // main loop for consume/produce, a small http server exists outside this thread for metrics collection
  thread::spawn(|| {
    let mut core = Core::new().unwrap();
    let handle = core.handle();
    let consumer = consumer_config.create().expect("can't create consumer");
    consumer.subscribe(//in the usual way);
    let message_stream = consumer.start().filter_map(|result| {
      // match for error handling here
    }).for_each(|message| {
      let payload = message.payload();
      match payload {
        Ok(payload) => {
          let res = // transformation of payload;
          match res {
            Ok(things) => {
              msgs = things.into_iter().map(|thing| { (thing.key(), thing.val1, thing_to_msg(thing))}).collect::<Vec(_,_, Vec<u8)>>{};
              for (key, val1, msg) in msgs{
                let send_thread = producer.clone();
                let process_message = send_thread.send_copy::<Vec<u8>, String>(
                ).and_then(move |d_report| {
                  // increment a metrics thing that got cloned
                  Ok(());
                }).or_else(|err| {
                  warn!("Error...")'
                  Ok(())
                });
                handle.spawn(process_message);
              }
            },
            // Err matches and reporting here
          }
        },
        // Err matches and reporting here
      } 
    });
    core.run(message_stream).unwrap();
  });

  // Http server stuff here
}

Behavior

This will run anywhere from 20 minutes to 2 hours, producing about 1.5M messages per minutue before the number of produced messages drops to 0. CPU for one thread will stay at 100% for an additional 10 minutes before the whole thing exists with a code of 139 (segfault). Logs below.

Logs

There's a string of messages about BrokerTransportFailure, from some or all of the brokers. Many brokers are mentioned more than once. The assertion error's timestamp provided by docker, which is why it's a little different looking.

2017-11-28T13:50:50.370186398+00:00 - librdkafka: Global error: BrokerTransportFailure (Local: Broker transport failure): node01:9092/bootstrap: Receive failed: Disconnected
...
2017-11-28T14:25:50.330383250+00:00 - librdkafka: Global error: BrokerTransportFailure (Local: Broker transport failure): node01:9092/bootstrap: Receive failed: Disconnected
2017-11-28T14:25:50.330724298Z - my_program: rd.h:298: rd_refcnt_sub0: Assertion `!*"refcnt sub-zero"' failed.

How to consume two topics with different configurations

I'm trying to do the following:

let consumer: StreamConsumer = ClientConfig::new()
    .set("group.id", &self.group_id)
    .set("bootstrap.servers", &self.brokers)
    .set("enable.auto.commit", "true")
    .set("auto.offset.reset", "latest")
    .set("enable.partition.eof", "false")
    .create()
    .expect("Consumer creation failed");

let mut partitions = TopicPartitionList::new();
partitions.add_partition_offset(&self.config_topic, 0, Offset::Beginning);
consumer.subscribe(&[&self.input_topic]).expect("Can't subscribe to specified topics");
consumer.assign(&partitions).expect("Can't subscribe to specified topics");

So in this case we subscribe to two topics, the other is a compact topic with configuration that's read always from beginning when you start the consumer, then additionally modifying the consumer state whenever there's new events in the config topic.

The other is a topic with lots of partitions, we must never consume these items more than once and we want to have automatic partition assignment. My code over here doesn't seem to do what I expect. If I keep it like so, I never get any items from the config topic, but the input topic data is consumed and handled. If I remove the .subscribe to input topic, the consumer consumes the config topic from beginning as I expect.

How to do this properly? It's handy to hold the mutable consumer state in the same loop, but it seems you cannot subscribe and assign partitions like I did above.

failed build on Ubuntu 16.04

When I tried cargo building this on Ubuntu 16.04, I encountered some linker errors:

Creating shared library librdkafka.so.1
gcc  -shared -Wl,-soname,librdkafka.so.1 -Wl,--version-script=librdkafka.lds rdkafka.o rdkafka_broker.o rdkafka_msg.o rdkafka_topic.o rdkafka_conf.o rdkafka_timer.o rdkafka_offset.o rdkafka_transport.o rdkafka_buf.o rdkafka_queue.o rdkafka_op.o rdkafka_request.o rdkafka_cgrp.o rdkafka_pattern.o rdkafka_partition.o rdkafka_subscription.o rdkafka_assignor.o rdkafka_range_assignor.o rdkafka_roundrobin_assignor.o rdkafka_feature.o rdcrc32.o crc32c.o rdaddr.o rdrand.o rdlist.o tinycthread.o rdlog.o rdstring.o rdkafka_event.o rdkafka_metadata.o rdregex.o rdports.o rdkafka_metadata_cache.o rdavl.o rdkafka_sasl.o rdkafka_sasl_plain.o rdkafka_interceptor.o rdkafka_msgset_writer.o rdkafka_msgset_reader.o rdvarint.o rdbuf.o rdunittest.o rdkafka_sasl_scram.o snappy.o rdgz.o rdkafka_lz4.o xxhash.o rddl.o rdkafka_plugin.o -o librdkafka.so.1 -Wl,-Bstatic -llz4 -Wl,-Bdynamic -lpthread -lz -lcrypto -lssl -lrt -ldl
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblz4.a(lz4frame.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblz4.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
../mklove/Makefile.base:88: recipe for target 'librdkafka.so.1' failed
make[1]: *** [librdkafka.so.1] Error 1
make[1]: Leaving directory '/home/stack/librdkafka/src'
Makefile:20: recipe for target 'libs' failed
make: *** [libs] Error 2

I didn't get to the root cause of this, but these errors can be avoided by not passing --enable-static to ./configure. Without this flag, the rdkafka library appears to build a static library anyway, and it does so successfully.

Can we just remove --enable-static from rdkafka-sys/build.rs?

Bug? Order of generic type parameters `P` and `K` seems to be switched

Issue

I got a strange error while updating a codebase to use the new version of rust-rdkafka, 0.18.0.

This code:

let record = FutureRecord::to(&topic)
    .payload(&payload);

producer.send::<String, ()>(record, -1);

gave an error:

error[E0308]: mismatched types
   --> src/code.rs:116:45
    |
116 |                 producer.send::<String, ()>(record, -1);
    |                                             ^^^^^^ expected struct `std::string::String`, found ()
    |
    = note: expected type `rdkafka::producer::future_producer::FutureRecord<'_, std::string::String, ()>`
               found type `rdkafka::producer::future_producer::FutureRecord<'_, (), std::string::String>`

From looking at the docs, I would expect a FutureRecord<'_, (), std::string::String>, as the definition of FutureRecord is:

pub struct FutureRecord<'a, K: ToBytes + ?Sized + 'a, P: ToBytes + ?Sized + 'a>....

K comes first, then P.

Suggested solution

Maybe I am overlooking something and this is expected behaviour, but in case it is not, here are my ideas on how to fix this bug.

Option 1

Switch P and K on line 206 in future_producer.rs.

The original line:

pub fn send<P, K>(&self, record: FutureRecord<P, K>, block_ms: i64) -> DeliveryFuture

This would become:

 pub fn send<P, K>(&self, record: FutureRecord<K,P>, block_ms: i64) -> DeliveryFuture 

Option 2 (I like this more)

Make the API consistent and change the definition of FutureRecord. First P, then K, just like the producers send function.

Thanks in advance!

Compilation fails w/ rust-musl-builder

When compiling a rust application using rdkafka on rust-musl-builder the build fails when linking:

My guess is that the rdkafka lib is build with glibc and then fails w/ musl.

Is there a way to specify what to build it against the same way that dynamic linking can be specified?

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello0-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello1-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello2-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello3-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello4-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.mshello5-66b6f0d31720f4bd44d6f265903cd36d.rs.rcgu.o" "-o" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/mshello-2054ff820a64761c.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps" "-L" "/home/rust/src/target/release/deps" "-L" "/home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src" "-L" "/home/rust/src/target/x86_64-unknown-linux-musl/release/build/libz-sys-9e0dfdf6ce77c312/out/lib" "-L" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-f68d8e8245e507c6.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka-a45674fad582d6de.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/liblibz_sys-d28970724bb40e9f.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/liblibc-eef0eb2737b72223.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libfutures-f1a25787e6cfbe44.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libserde_json-fded606be9e377b3.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libitoa-539d7e09fab6c05d.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libdtoa-19c34238b45a98bc.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libserde-30812860af6099f8.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/liblog-4de18e7534a813d8.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/liblog-9a6200d5626a5e8a.rlib" "/home/rust/src/target/x86_64-unknown-linux-musl/release/deps/libcfg_if-5f123802e50df72d.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-8d847bbe97fc9dc5.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-008c42aad548e7dd.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-0fe53371ec419e32.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_system-9dec1cbd51097ce1.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-6a4fb915dd86d140.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-7ebba6af2d3cc324.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_unicode-7a26f8b3cf380464.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-b0c2d164a9741309.rlib" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-66d072e25a9acee3.rlib" "-static" "-Wl,-Bdynamic" "/home/rust/.rustup/toolchains/1.26.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)"
  = note: /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `vsnprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:77: undefined reference to `__vsnprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:77: undefined reference to `__vsnprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:64: more undefined references to `__snprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `vsnprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:77: undefined reference to `__vsnprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `rd_strndup':
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o):/home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: more undefined references to `__strndup' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka.o): In function `syslog':
          /usr/include/x86_64-linux-gnu/bits/syslog.h:31: undefined reference to `__syslog_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `vsnprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:77: undefined reference to `__vsnprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_broker.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_msg.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_msg.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:64: more undefined references to `__snprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_conf.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_offset.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_transport.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_transport.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:64: more undefined references to `__snprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_transport.o): In function `poll':
          /usr/include/x86_64-linux-gnu/bits/poll2.h:41: undefined reference to `__poll_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_buf.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_buf.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_buf.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_queue.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_op.o): In function `vsnprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:77: undefined reference to `__vsnprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_op.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_op.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o): In function `rd_strndup':
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_request.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o): In function `rd_strndup':
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_cgrp.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_pattern.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `rd_strndup':
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_partition.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_assignor.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdstring.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:64: more undefined references to `__snprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_metadata.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_metadata.o): In function `rd_strndup':
          /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src/rd.h:127: undefined reference to `__strndup'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdbuf.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdbuf.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(snappy.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rddl.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rddl.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:64: more undefined references to `__snprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(crc32c.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(crc32c.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdaddr.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdaddr.o): In function `strncpy':
          /usr/include/x86_64-linux-gnu/bits/string3.h:126: undefined reference to `__strncpy_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdaddr.o): In function `strcpy':
          /usr/include/x86_64-linux-gnu/bits/string3.h:110: undefined reference to `__memcpy_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdlist.o): In function `printf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:104: undefined reference to `__printf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:104: undefined reference to `__printf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_metadata_cache.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_sasl.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_msgset_reader.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_msgset_reader.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_msgset_reader.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdvarint.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdvarint.o):/usr/include/x86_64-linux-gnu/bits/stdio2.h:97: more undefined references to `__fprintf_chk' follow
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdkafka_plugin.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdlog.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdlog.o): In function `snprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:64: undefined reference to `__snprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdlog.o): In function `fprintf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:97: undefined reference to `__fprintf_chk'
          /home/rust/src/target/x86_64-unknown-linux-musl/release/deps/librdkafka_sys-1dabf5d6227192b6.rlib(rdlog.o): In function `printf':
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:104: undefined reference to `__printf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:104: undefined reference to `__printf_chk'
          /usr/include/x86_64-linux-gnu/bits/stdio2.h:104: undefined reference to `__printf_chk'

First time user

Hello! I've recently tried to use rust-rdkafka, and thought I would share some experiences. I think there may be some "issues" here, but there could also just be some helpful information about what people (person) stumble over.

First off, thank you! This is in support of a timely dataflow Kafka adapter, which I wouldn't want to try and write without a crate. :)

I wanted to try sending a message through kafka and back, so I wrote what seemed like a pretty simple program, following your examples but using the Base* variants of producer and consumer.

fn round_trip(brokers: &str, topic_name: &str) -> Result<(), rdkafka::error::KafkaError> {

    let mut topic_config = TopicConfig::new();
    topic_config
        .set("produce.offset.report", "true")
        .finalize();

    let mut client_config = ClientConfig::new();
    client_config
        .set("group.id", "example")
        .set("bootstrap.servers", brokers)
        .set_default_topic_config(topic_config);

    let producer: BaseProducer<_> = try!(client_config.create());
    let consumer: BaseConsumer<_> = try!(client_config.create());

    try!(consumer.subscribe(&[topic_name]));

    let text = format!("hi there at {:?}", ::std::time::Instant::now());
    try!(producer.send_copy::<str,()>(topic_name, None, Some(text.as_str()), None,  None, None));

    for _ in 0 .. 100 {

        producer.poll(1);

        if let Some(result) = try!(consumer.poll(1)) {
            println!("{:?}:\t{:?}", ::std::time::Instant::now(), result.payload_view::<str>());
            try!(consumer.commit(None, rdkafka::consumer::CommitMode::Sync));
        }
        else {
            println!("{:?}:\tgot nothing", ::std::time::Instant::now());
        }
    }

    Ok(())
}

The behavior was a bit surprising, and it was tricky to find documentation to explain if this was expected.

  1. This seems to run to completion just fine, printing "got nothing" 100 times and returning Ok(()) when neither ZK nor Kafka are up and running. Where is the moment in the code it is supposed to complain if they are not installed or up and running? (when they are up and running, it does seem to connect and occasionally round-trip data; mysterious things happen).

  2. I'm not a Kafka expert, so I was surprised to see things like "nothing more to read now" surface as an error (PartitionEOF) rather than the absence of a message. I imagine that is just what rdkafka thinks is best and returns to you, so you want to surface it up?

  3. The BaseProducer documentation speaks of a BaseProducerTopic that I should use, but I couldn't find this. Is it just stale documentation?

  4. I was hoping to have a non-blocking poll, but I'm not sure if this is what an argument of 0 would mean. Sometimes 0 means "block". Is that something you could clarify in the documentation? It could be that rdkafka does what it does and won't let us fcntl the socket to non-blocking mode, or something like that, but would be good to know!

Maybe as a meta comment, if BaseProducer and BaseConsumer are meant to be a very thin layer on top of rdkafka, with the caveat that you had best understand the details of rdkafka (which I don't yet), you could say that in the documentation (I'm still not sure). I'm sure it is still useful, but would keep me from scratching / banging my head.

I'm going to try out the "higher-level" stuff next, but I'd have preferred to just have a non-blocking polling interface. If that should work out, and I just need more Kafka protocol expertise, I can push on it more and come back with comments on that.

Thanks again!

Can't seem to get consumer to consume at all.

I've verified that the topic has two partitions with populated values:

root@kafka-cluster-0:/# kafka-topics --zookeeper kafka-cluster-zookeeper.default.svc.cluster.local --describe --topic api-service.v1
Topic:api-service.v1	PartitionCount:2	ReplicationFactor:1	Configs:
	Topic: api-service.v1	Partition: 0	Leader: 0	Replicas: 0	Isr: 0
	Topic: api-service.v1	Partition: 1	Leader: 0	Replicas: 0	Isr: 0
root@kafka-cluster-0:/# kafka-run-class kafka.tools.GetOffsetShell  --topic api-service.v1 --broker-list localhost:9092
api-service.v1:0:1
api-service.v1:1:1

Consumer config is pretty straightforward:

let consumer: StreamConsumer = ClientConfig::new()
    .set("group.id", Config::GROUP_ID)
    .set("bootstrap.servers", self.config.kafka_brokers.as_str())
    .set("enable.auto.commit", "false")
    .set("auto.offset.reset", "smallest")
    .set_log_level(RDKafkaLogLevel::Debug)
    .create().expect("Consumer creation failed.");
consumer.subscribe(&Config::TOPICS).expect("Failed to subscribe to target topics.");

for msg_result in consumer.start_with(Duration::from_secs(10), true).wait() {
    match msg_result {
        ...
    }
}

I am getting the expected NoMessageReceived errors, but that doesn't abort the stream. None of the actual messages from the topic partitions come through though.

Every time I get the NoMessageReceived, I am doing the following for debugging purposes:

let assignments = consumer.subscription().expect("Expected to successfully fetch subscription info.");
println!("Assignments: {:?}", assignments);

let data = consumer.position().expect("Expected to successfully fetch position info.");
println!("Positions: {:?}", data);

And all I get is the following in the console:

Assignments: TPL {(api-service.v1, -1): Invalid, }
Positions: TPL {}

Any ideas on what is going on here?

ClientConfig::create does not throw error if kafka topic is not reachable

I mistakenly gave wrong ip address of kafka. But below line of code got executed successfully without giving any error

 let producer = ClientConfig::new()
        .set("bootstrap.servers", brokers)
            .set("produce.offset.report", "true")
        .create::<FutureProducer<_>>()
.expect("Producer creation error");

It got detected only once i did producer.send(...). I am trying to do send inside a mpsc channel and thus want to detect whether producer is connected or not at the time of creating it. How should i go about it?

Several unsound from_ptr methods

Hello

Reading through the documentation, I noticed there are some methods that are very likely unsound โ€’ they aren'd marked as unsafe, but in fact they are, breaking Rusts safety protections. I discovered these:

NativeClient::from_ptr
NativeTopic::from_ptr
NativeClientConfig::from_ptr
Metadata::from_ptr

If I call them with eg. NativeClient::from_ptr(1234 as _), I haven't used any unsafe code in my code, but the program will still explode with undefined behaviour.

Would it be OK to mark them as unsafe?

Message headers support?

Looks like librdkafka's rd_kafka_msg_t -> rkm_headers is not reflected in the rdkafka's API. I'm sure it's not a trivial thing, but it's something our infrastructure uses to figure out how to deserialize the messages. Is there a plan to expose the headers in the Message trait?

Thanks!

rdkafka queue assertion is firing

I was benchmarking a consumer process against a cluster with 20 brokers and a topic with 30 partitions. I disabled all the log statements, so not much to see, but the program crashes after 5 minutes with:

$ ./target/release/ridb
*** rdkafka_queue.h:188:rd_kafka_q_destroy0: assert: rkq->rkq_refcnt > 0 ***

Need support of tokio library

https://github.com/tokio-rs/tokio-core is deprecated. It is being replaced by https://github.com/tokio-rs/tokio

When i tried using tokio to run a consumer , i am getting following error
error[E0277]: std::cell::Cell<std::option::Option<std::thread::JoinHandle<()>>> cannot be shared between threads safely
--> src/main.rs:1481:6
|
1481 | tokio::run(h);
| ^^^^^^^^^^ std::cell::Cell<std::option::Option<std::thread::JoinHandle<()>>> cannot be shared between threads safely
|
= help: within rdkafka::consumer::StreamConsumer, the trait std::marker::Sync is not implemented for std::cell::Cell<std::option::Option<std::thread::JoinHandle<()>>>
= note: required because it appears within the type rdkafka::consumer::StreamConsumer
= note: required because of the requirements on the impl of std::marker::Send for &rdkafka::consumer::StreamConsumer
= note: required because it appears within the type rdkafka::consumer::MessageStream<'_, rdkafka::consumer::DefaultConsumerContext>
= note: required because it appears within the type futures::stream::FilterMap<rdkafka::consumer::MessageStream<'_, rdkafka::consumer::DefaultConsumerContext>, [closure@src/main.rs:1444:42: 1452:10]>
= note: required because it appears within the type futures::stream::ForEach<futures::stream::FilterMap<rdkafka::consumer::MessageStream<'_, rdkafka::consumer::DefaultConsumerContext>, [closure@src/main.rs:1444:42: 1452:10]>, [closure@src/main.rs:1452:21: 1474:10], std::result::Result<(), ()>>
= note: required by tokio::run

Asynchronous processing example

The design of the producer and the consumer allow the users to run them asynchronously, and to integrate them with the tokio-rs project.

At the moment there is no example on how to do so.

Can I use dynamic librdkafka on my system?

I'm surprised it contains librdkafka source and builds it, instead of linking the one from my system. And it fails, because I'm on Arch Linux and there are no static libs for most libraries. Fixing all the static libs requires huge amount of work.

Yes I can switch to another system to develop my program though it's inconvenient. But what rdkafka version does it bundle? I see git commands in the build scripts....No, I'm not going to deploy programs containing libraries of random git versions.

Could Message provide `payload_mut`?

I'm not a Kafka expert, but looking at the various bits and pieces, it seems possible that the Message trait could provide a

    fn payload_mut(&mut self) -> Option<&mut [u8]>;

Looking at the RdKafka::Message docs, it looks like the payload() method returns a void* without a const modifier (unlike the key_ptr() method which is const void*). My C++ is not super-strong, but my sense is that this signature means that one can safely mutate the results of payload().

The motivation might be limited, but it saves a copy for me (Abomonation does deserialization using in-place pointer correction). If it is a no-brainer, then great! If it is weird and mysterious and scary, I can understand that too.

Running StreamConsumer with tokio's executor

Currently how StreamConsumer stores the JoinHandle in a Cell prevents us of using the consumer in tokio's thread_pool executor, which expects the consumer to implement Send. In other hand using the current_thread executor doesn't comply with missing static lifetimes somewhere in the consumer code I haven't been able to locate yet.

Is there plans to support the new executors, especially when the development of tokio-core and futures-cpupool seems to be stalled in favor of tokio?

Export stats in parsed structure

In the current version, client statistics are only available in JSON format. rdkafka should provide a function to parse the JSON into a defined structure, where each field is easily accessible.

Remove deprecated tx.complete

The complete method used to complete the future associated with the result of a send in the FutureProducer is deprecated, and we should use send instead. send requires a different handling of the returned error, which should be implemented as well.

FutureProducer should have a working ProducerContext (or none at all)

From @fede1024 in #22:

The way the FutureProducer allows to specify a ProducerContext is very confusing at the moment, since the only method currently available in the trait is not actually executed (since it is used by the FutureProducer itself). I think we should remove this test, since it is a bit misleading.

I'll update the FutureProducer to use a different trait instead of ProducerContext (or nothing at all).

Not able to spawn a consumer using tokio core handle

I already have core instance available. I want to spawn a consumer using handle of core

  let processed_stream = consumer.start();
     let h = processed_stream.filter_map(|result| {  // Filter out errors
            match result {
                Ok(msg) => Some(msg),
                Err(kafka_error) => {
                    println!("Error while receiving from Kafka: {:?}", kafka_error);
                    None
                }
            }
        }).for_each(|msg| {     // Process each message
            println!("Enqueuing message for computation");
            let owned_message = msg.detach();
            let t = match owned_message.payload_view::<str>() {
                Some(Ok(payload)) => String::from(payload),
                Some(Err(_)) => "Error processing message payload".to_owned(),
                None => "No payload".to_owned(),
            };
            let k = match owned_message.key_view::<str>() {
                Some(Ok(key)) => String::from(key),
                Some(Err(_)) => "Error processing message key".to_owned(),
                None => "No key".to_owned(),
            };
            // Create the inner pipeline, that represents the processing of a single event.
            // Spawns the inner pipeline in the same event pool.
            //let d = http_call(3, 4, owned_message);
            //println!("Response is {}", d);
            // http_call(owned_message);
            // load_merchant_script(String::from(input_topic), t);
             let tx = HASHMAP.write().unwrap().remove(&k[..]).unwrap();
             println!("Consumer cp4");
             tx.send(t).unwrap();
            // println!("Message is {}",t);
            Ok(())
        });
    println!("Starting event loop");
    // Runs the event pool until the consumer terminates.
    //handle.spawn(processed_stream);
    handle.spawn(h);

I am getting below error

   Compiling payu_dsl_core v0.1.0 (file:///home/suraj.prakash/projects/payu_dsl_core)
warning: unnecessary parentheses around `if` condition
    --> main.rs:1045:19
     |
1045 |                 if(f > max){max = f;st.clear();st.push_str(&st2i[..]);}
     |                   ^^^^^^^^^
     |
     = note: #[warn(unused_parens)] on by default

error[E0597]: `consumer` does not live long enough
   --> main.rs:943:28
    |
943 |     let processed_stream = consumer.start();
    |                            ^^^^^^^^ does not live long enough
...
982 | }
    | - borrowed value only lives until here

Update examples with default topic config passthrough

From librdkafka 0.11 the default topic configuration can be set using rd_kafka_conf_set directly. The document in librdkafka can now be updated and simplified.

Additionally, the TopicConfig struct can be made private or removed, as it's not needed anymore (but it might be needed in the future if support on the producer side is added).

Build failing with feature "ssl" on Fedora 29 (OpenSSL 1.1.1)

I'm getting the following build failure while attempting to compile a project which depends on rdkafka = { version = "~0.17", features = ["ssl", "sasl"] }:

error: failed to run custom build command for `openssl v0.9.24`
process didn't exit successfully: `/home/jgrillo/src/contrive.app/target/debug/build/openssl-4ebb9589f9d6f362/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/jgrillo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: Run with `RUST_BACKTRACE=1` for a backtrace.

I think this is due to sfackler/rust-openssl#1024 (https://github.com/fede1024/rust-rdkafka/blob/master/rdkafka-sys/Cargo.toml#L15). Apparently upgrading to openssl-sys ~0.10.0 should fix it. Are you aware of any obvious consequences to updating rust-rdkafka to depend on openssl-sys ~0.10.0?

I'm a little time constrained at the moment, I'll try to attempt this within the next few days.

Edit:
Actually, I'm not even sure whether librdkafka supports OpenSSL 1.1.x yet..
This was merged to master in October confluentinc/librdkafka#2000, it's possible librdkafka v0.11.6 has these changes.

Using messages beyond lifetime of consumer hangs thread

If you try to collect messages and use them after dropping the consumer the thread hangs indefinitely.

This test (in produce_consume_base_test.rs) reproduces the issue:

// All produced messages should be consumed.
#[test]
fn test_produce_consume_messages_beyond_consumer_lifetime() {
    let _r = env_logger::init();

    let topic_name = rand_test_topic();
    let _message_map = produce_messages(&topic_name, 100, &value_fn, &key_fn, None, None);
    let mut messages = Vec::new();

    // Drop consumer before checking vector contents
    {
        let mut consumer = create_stream_consumer(&rand_test_group(), None);
        consumer.subscribe(&vec![topic_name.as_str()]).unwrap();

        let _consumer_future = consumer.start()
            .take(100)
            .for_each(|message| {
                match message {
                    Ok(m) => messages.push(m),
                    Err(e) => panic!("Error receiving message: {:?}", e)
                };
                Ok(())
            })
            .wait();
    }

    assert_eq!(100, messages.len());
}

Reliable segfault using ProducerContext + BaseProducer + mutexes

I'm trying to set up BaseProducer to send delivery reports on a MPSC channel, and I'm getting reliable segfaults. Based on the core dump (which is deep within Rust's std::sync::Mutex), it appears that the ProducerContext might be being copied without calling .clone() and somehow corrupting the mutex inside.

I put a small reproducer up at https://github.com/Roguelazer/rdkafka_mpsc_test/blob/master/src/main.rs if that's helpful.

Any thoughts?

Example doesn't work with futures 0.2.0

The async processing example works on futures 0.1.20 but fails on the latest futures 0.2.0 release with the following errors:

// Create the outer pipeline on the message stream.
let processed_stream = consumer.start()
.filter_map(|result| { // Filter out errors
match result {
Ok(msg) => Some(msg),
Err(kafka_error) => {
warn!("Error while receiving from Kafka: {:?}", kafka_error);
None
}
}
}).for_each(|msg| { // Process each message
info!("Enqueuing message for computation");
let producer = producer.clone();
let topic_name = output_topic.to_owned();
let owned_message = msg.detach();
// Create the inner pipeline, that represents the processing of a single event.
let process_message = cpu_pool.spawn_fn(move || {
// Take ownership of the message, and runs an expensive computation on it,
// using one of the threads of the `cpu_pool`.
Ok(expensive_computation(&owned_message))
}).and_then(move |computation_result| {
// Send the result of the computation to Kafka, asynchronously.
info!("Sending result");

error[E0599]: no method named `filter_map` found for type `rdkafka::consumer::MessageStream<'_, rdkafka::consumer::DefaultConsumerContext>` in the current scope
  --> src/main.rs:81:10
   |
81 |         .filter_map(|result| {  // Filter out errors
   |          ^^^^^^^^^^
   |
   = note: the method `filter_map` exists but the following trait bounds were not satisfied:
           `&mut rdkafka::consumer::MessageStream<'_, rdkafka::consumer::DefaultConsumerContext> : std::iter::Iterator`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
   |
10 | use futures::stream::Stream;
   |

error[E0599]: no method named `and_then` found for type `futures_cpupool::CpuFuture<std::string::String, _>` in the current scope
  --> src/main.rs:99:12
   |
99 |         }).and_then(move |computation_result| {
   |            ^^^^^^^^
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
   |
10 | use futures::future::Future;
   |
[dependencies]
log = "0.4.1"
futures = "0.2.0"
# futures = "0.1.20" # works
futures-cpupool = "0.1.8"
rand = "0.5.0-pre.0"
tokio-core = "0.1.17"
rdkafka = "0.15.0"

rust-rdkafka 0.13 is reporting production errors incorrectly

0.13.0 is reporting production errors as rdkafka::error::KafkaError::MessageConsumption instead of rdkafka::error::KafkaError::MessageProduction. I assume this is because err_field_to_kafka_error now always returns MessageConsumption.

My code (which is production-only) was working under 0.12 but isn't under 0.13, so it seems like this is a regression?

Example: If I attempt to produce a message which is larger than the Kafka max message size, the Debug representation of the error is

KafkaError (Message consumption error: MessageSizeTooLarge (Broker: Message size too large))

async batching support

It seems it doesn't support async batching like java producer?
To make it work API probably has to be changed/extended, are you thinking about adding it?

Create non-copy producer

At the moment the producer will provide a copy of the message to the underlying librdkafka client. Rust-rdkafka should provide a method that takes ownership of the message and gives it in non-copy mode to librdkafka, saving one allocation/free.

Add confluent avro serializer.

In a pet project on a private repo I'm able to both consume and produce massages compatible with the Confuent schema registry. I wonder if it might be a good idea to add. It's also possible to put them as separate functions in a crate, but in a way it's compatible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.