kafka_callback.hpp
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
7 #include <cudf/io/datasource.hpp>
8 
9 #include <librdkafka/rdkafkacpp.h>
10 
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 namespace cudf {
16 namespace io {
17 namespace external {
18 namespace kafka {
19 
38 using kafka_oauth_callback_wrapper_type = std::map<std::string, std::string> (*)(void*);
39 using python_callable_type = void*;
40 
45 class python_oauth_refresh_callback : public RdKafka::OAuthBearerTokenRefreshCb {
46  public:
56  python_oauth_refresh_callback(kafka_oauth_callback_wrapper_type callback_wrapper,
57  python_callable_type python_callable);
58 
65  void oauthbearer_token_refresh_cb(RdKafka::Handle* handle, std::string const& oauthbearer_config);
66 
67  private:
68  kafka_oauth_callback_wrapper_type callback_wrapper_;
69  python_callable_type python_callable_;
70 };
71 
72 } // namespace kafka
73 } // namespace external
74 } // namespace io
75 } // namespace cudf
Callback to retrieve OAuth token from external source. Invoked when token refresh is required.
void oauthbearer_token_refresh_cb(RdKafka::Handle *handle, std::string const &oauthbearer_config)
Invoke the Python callback function to get the OAuth token and its expiration time.
python_oauth_refresh_callback(kafka_oauth_callback_wrapper_type callback_wrapper, python_callable_type python_callable)
Construct a new python oauth refresh callback object.
cuDF interfaces
Definition: host_udf.hpp:26