|
| 1 | +--- |
| 2 | +title: "C++ Client" |
| 3 | +sidebar_position: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +# Fluss C++ Client |
| 7 | + |
| 8 | +The Fluss C++ Client provides a high-performance, synchronous interface for |
| 9 | +interacting with Fluss clusters. It manages an internal Tokio runtime and |
| 10 | +supports Apache Arrow for efficient data interchange. |
| 11 | + |
| 12 | +The client provides two main APIs: |
| 13 | + |
| 14 | +- **[Admin API](https://clients.fluss.apache.org/user-guide/cpp/api-reference#admin)**: For managing databases, tables, and partitions. |
| 15 | +- **[Table API](https://clients.fluss.apache.org/user-guide/cpp/api-reference#table)**: For reading and writing to Log and Primary Key tables. |
| 16 | + |
| 17 | +## Installation |
| 18 | + |
| 19 | +The C++ client is not yet published as a package and must be built from source. |
| 20 | + |
| 21 | +**Prerequisites:** CMake 3.22+, C++17 compiler, Rust 1.85+, Apache Arrow C++ library |
| 22 | + |
| 23 | +Install dependencies: |
| 24 | +```bash |
| 25 | +# macOS |
| 26 | +brew install cmake arrow |
| 27 | + |
| 28 | +# Ubuntu/Debian |
| 29 | +sudo apt-get install cmake libarrow-dev |
| 30 | +``` |
| 31 | +```bash |
| 32 | +git clone https://github.com/apache/fluss-rust.git |
| 33 | +cd fluss-rust/bindings/cpp |
| 34 | +mkdir -p build && cd build |
| 35 | +cmake -DCMAKE_BUILD_TYPE=Release .. |
| 36 | +cmake --build . |
| 37 | +``` |
| 38 | + |
| 39 | +For full build options including CMake integration into your own project, see the |
| 40 | +[C++ client installation guide](https://clients.fluss.apache.org/user-guide/cpp/installation). |
| 41 | + |
| 42 | +## Quick Example |
| 43 | +```cpp |
| 44 | +#include "fluss.hpp" |
| 45 | + |
| 46 | +int main() { |
| 47 | + fluss::Configuration config; |
| 48 | + config.bootstrap_servers = "127.0.0.1:9123"; |
| 49 | + |
| 50 | + fluss::Connection conn; |
| 51 | + fluss::Result result = fluss::Connection::Create(config, conn); |
| 52 | + if (!result.Ok()) { |
| 53 | + std::cerr << "Connection failed: " << result.error_message << std::endl; |
| 54 | + return 1; |
| 55 | + } |
| 56 | + |
| 57 | + fluss::Admin admin; |
| 58 | + conn.GetAdmin(admin); |
| 59 | + |
| 60 | + return 0; |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +For more examples, see the [Fluss C++ Client documentation](https://clients.fluss.apache.org/user-guide/cpp/example/). |
| 65 | + |
| 66 | +## Full Documentation |
| 67 | + |
| 68 | +For the complete C++ client reference including all configuration options, |
| 69 | +API methods, data types, error handling, and worked examples — see the |
| 70 | +**[Fluss C++ Client documentation](https://clients.fluss.apache.org/user-guide/cpp/installation)**. |
0 commit comments