Proactive Safety Framework  1.0
NvPSFKafka.h File Reference
#include <stddef.h>

Go to the source code of this file.

Classes

struct  NvPSFKafkaStatus
 

Typedefs

typedef struct NvPSFKafkaHandle_t NvPSFKafkaHandle
 

Enumerations

enum  NvPSFKafkaErr { NvPSFKAFKA_SUCCESS = 0 , NvPSFKAFKA_FAIL = 1 }
 
enum  NvPSFKafkaEndpointType { KAFKA_PRODUCER = 0 , KAFKA_CONSUMER = 1 }
 

Functions

NvPSFKafkaStatus NvPSFKafkaCreate (const char *brokers, const char *topic, NvPSFKafkaEndpointType endpointType, const char *group_id, NvPSFKafkaHandle **out_handle)
 Create a Kafka producer or consumer handle. More...
 
NvPSFKafkaStatus NvPSFKafkaDestroy (NvPSFKafkaHandle *handle)
 Destroy a Kafka handle and free resources. More...
 
NvPSFKafkaStatus NvPSFKafkaSend (NvPSFKafkaHandle *handle, const void *msg, size_t msgLen)
 Send a message to Kafka (producer only). More...
 
NvPSFKafkaStatus NvPSFKafkaReceive (NvPSFKafkaHandle *handle, void *buffer, size_t bufferLen, size_t *outLen)
 Receive a message from Kafka (consumer only). More...
 
NvPSFKafkaStatus NvPSFKafkaSeekToEnd (NvPSFKafkaHandle *handle)
 Seek to the end of partitions after subscription (consumer only). More...
 

Typedef Documentation

◆ NvPSFKafkaHandle

typedef struct NvPSFKafkaHandle_t NvPSFKafkaHandle

Enumeration Type Documentation

◆ NvPSFKafkaEndpointType

Enumerator
KAFKA_PRODUCER 
KAFKA_CONSUMER 
43  {
44  KAFKA_PRODUCER = 0,
45  KAFKA_CONSUMER = 1
NvPSFKafkaEndpointType
Definition: NvPSFKafka.h:43
@ KAFKA_CONSUMER
Definition: NvPSFKafka.h:45
@ KAFKA_PRODUCER
Definition: NvPSFKafka.h:44

◆ NvPSFKafkaErr

Enumerator
NvPSFKAFKA_SUCCESS 
NvPSFKAFKA_FAIL 
32  {
34  NvPSFKAFKA_FAIL = 1
NvPSFKafkaErr
Definition: NvPSFKafka.h:32
@ NvPSFKAFKA_FAIL
Definition: NvPSFKafka.h:34
@ NvPSFKAFKA_SUCCESS
Definition: NvPSFKafka.h:33

Function Documentation

◆ NvPSFKafkaCreate()

NvPSFKafkaStatus NvPSFKafkaCreate ( const char *  brokers,
const char *  topic,
NvPSFKafkaEndpointType  endpointType,
const char *  group_id,
NvPSFKafkaHandle **  out_handle 
)

Create a Kafka producer or consumer handle.

Parameters
brokersComma-separated list of broker addresses.
topicKafka topic name.
endpointTypeProducer or Consumer.
group_id(Consumer only) Consumer group ID, NULL for producer.
out_handlePointer to handle pointer to be set on success.
Returns
NvPSFKafkaStatus indicating success or failure.

◆ NvPSFKafkaDestroy()

NvPSFKafkaStatus NvPSFKafkaDestroy ( NvPSFKafkaHandle handle)

Destroy a Kafka handle and free resources.

Parameters
handlePointer to NvPSFKafkaHandle.
Returns
NvPSFKafkaStatus indicating success or failure.

◆ NvPSFKafkaReceive()

NvPSFKafkaStatus NvPSFKafkaReceive ( NvPSFKafkaHandle handle,
void *  buffer,
size_t  bufferLen,
size_t *  outLen 
)

Receive a message from Kafka (consumer only).

Parameters
handleNvPSFKafkaHandle for consumer.
bufferBuffer to store received message.
bufferLenSize of buffer.
outLenPointer to size_t to store actual message length.
Returns
NvPSFKafkaStatus indicating success or failure and number of bytes received.

◆ NvPSFKafkaSeekToEnd()

NvPSFKafkaStatus NvPSFKafkaSeekToEnd ( NvPSFKafkaHandle handle)

Seek to the end of partitions after subscription (consumer only).

Parameters
handleNvPSFKafkaHandle for consumer.
Returns
NvPSFKafkaStatus indicating success or failure.

◆ NvPSFKafkaSend()

NvPSFKafkaStatus NvPSFKafkaSend ( NvPSFKafkaHandle handle,
const void *  msg,
size_t  msgLen 
)

Send a message to Kafka (producer only).

Parameters
handleNvPSFKafkaHandle for producer.
msgPointer to message data.
msgLenLength of message.
Returns
NvPSFKafkaStatus indicating success or failure.