-
Notifications
You must be signed in to change notification settings - Fork 4
/
nsemq_producer.h
31 lines (25 loc) · 910 Bytes
/
nsemq_producer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef NSEMQ_PRODUCER_H_
#define NSEMQ_PRODUCER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "nsemq_base.h"
/**
* initialize producer
* @param broker_addr: the broker server address , i.e. "localhost:9092".
* @param dr_msg_cb: deliver report callback function pointer, which defined by the user and will be auto-called internally.
*/
NSEMQ_API ErrorCode nsemq_producer_init(const char *broker_addr, dr_cb_func dr_msg_cb);
/**
* produce message with 'msg' to topic with `topic'
* @param msg: message to be produced, which is the struct pointer type, i.e. nse_cpx *cpx.
* @param topic: topic to be published belong above msg.
*/
NSEMQ_API ErrorCode nsemq_producer_produce(void *msg, const char *topic);
/* close the producer handle, and destroy the allocated memory. */
NSEMQ_API ErrorCode nsemq_producer_close();
#ifdef __cplusplus
}
#endif
#endif //NSEMQ_PRODUCER_H_