forked from fede1024/rust-rdkafka
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Send + Sync on BorrowedMessage
librdkafka is entirely thread safe, and guarantees that the memory referenced by a BorrowedMessage will remain valid as long as the consumer remains valid. Since BorrowedMessage has a reference to the consumer inside, Rust will enforce this invariant, and it is therefore safe to mark BorrowedMessage as Send + Sync. Also update the asynchronous_processing example to make use of this new feature. The example now allows spawning multiple workers, which requires tokio::spawn, which turn requires that the generated future implement Send, which finally requires the adjustment made in this patch. Fix fede1024#85. Fix fede1024#189.
- Loading branch information
Showing
2 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters