Proactive Safety Framework  1.0
NvPSFKafka.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11 */
23 #ifndef NVPSF_KAFKA_H
24 #define NVPSF_KAFKA_H
25 
26 #include <stddef.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef enum {
34  NvPSFKAFKA_FAIL = 1
36 
37 typedef struct {
39  int retCode; // 0 for success, or error code
40  size_t recvd_bytes; // For receive, number of bytes received
42 
43 typedef enum {
45  KAFKA_CONSUMER = 1
47 
48 typedef struct NvPSFKafkaHandle_t NvPSFKafkaHandle;
49 
60 NvPSFKafkaStatus NvPSFKafkaCreate(const char* brokers, const char* topic, NvPSFKafkaEndpointType endpointType, const char* group_id, NvPSFKafkaHandle** out_handle);
61 
69 
78 NvPSFKafkaStatus NvPSFKafkaSend(NvPSFKafkaHandle* handle, const void* msg, size_t msgLen);
79 
89 NvPSFKafkaStatus NvPSFKafkaReceive(NvPSFKafkaHandle* handle, void* buffer, size_t bufferLen, size_t* outLen);
90 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif // NVPSF_KAFKA_H
104 
NvPSFKafkaStatus NvPSFKafkaSend(NvPSFKafkaHandle *handle, const void *msg, size_t msgLen)
Send a message to Kafka (producer only).
NvPSFKafkaStatus NvPSFKafkaCreate(const char *brokers, const char *topic, NvPSFKafkaEndpointType endpointType, const char *group_id, NvPSFKafkaHandle **out_handle)
Create a Kafka producer or consumer handle.
NvPSFKafkaEndpointType
Definition: NvPSFKafka.h:43
@ KAFKA_CONSUMER
Definition: NvPSFKafka.h:45
@ KAFKA_PRODUCER
Definition: NvPSFKafka.h:44
struct NvPSFKafkaHandle_t NvPSFKafkaHandle
Definition: NvPSFKafka.h:48
NvPSFKafkaStatus NvPSFKafkaDestroy(NvPSFKafkaHandle *handle)
Destroy a Kafka handle and free resources.
NvPSFKafkaStatus NvPSFKafkaReceive(NvPSFKafkaHandle *handle, void *buffer, size_t bufferLen, size_t *outLen)
Receive a message from Kafka (consumer only).
NvPSFKafkaStatus NvPSFKafkaSeekToEnd(NvPSFKafkaHandle *handle)
Seek to the end of partitions after subscription (consumer only).
NvPSFKafkaErr
Definition: NvPSFKafka.h:32
@ NvPSFKAFKA_FAIL
Definition: NvPSFKafka.h:34
@ NvPSFKAFKA_SUCCESS
Definition: NvPSFKafka.h:33
Definition: NvPSFKafka.h:37
size_t recvd_bytes
Definition: NvPSFKafka.h:40
NvPSFKafkaErr err
Definition: NvPSFKafka.h:38
int retCode
Definition: NvPSFKafka.h:39