summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-09-19 15:58:39 +0800
committeryangwei <[email protected]>2024-09-19 15:58:39 +0800
commit87944eb1153db3c39c330acb057a31d611d2b459 (patch)
tree8a0fb58572829ff71112b29b8d7744b002583dae /include
parentba13baaf344ac69bd0517d73db3cb7cdd5de4195 (diff)
✨ feat(mq): mq_runtime_clean in mq.h
Diffstat (limited to 'include')
-rw-r--r--include/stellar/mq.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/stellar/mq.h b/include/stellar/mq.h
index 0afc201..aa7b416 100644
--- a/include/stellar/mq.h
+++ b/include/stellar/mq.h
@@ -9,10 +9,6 @@ struct mq_schema;
struct mq_schema *mq_schema_new();
void mq_schema_free(struct mq_schema *s);
-struct mq_runtime;
-struct mq_runtime *mq_runtime_new(struct mq_schema *s);
-void mq_runtime_free(struct mq_runtime *s);
-
typedef void mq_msg_free_cb_func(void *msg, void *msg_free_arg);
typedef void on_msg_cb_func(int topic_id, void *msg, void *on_msg_arg);
typedef void on_msg_dispatch_cb_func(int topic_id,
@@ -44,8 +40,14 @@ int mq_schema_destroy_topic(struct mq_schema *s, int topic_id);
int mq_schema_subscribe(struct mq_schema *s, int topic_id, on_msg_cb_func *on_msg_cb, void * on_msg_cb_arg);
-int mq_runtime_publish_message(struct mq_runtime *rt, int topic_id, void *msg);
-void mq_runtime_dispatch(struct mq_runtime *rt);
+struct mq_runtime;
+struct mq_runtime *mq_runtime_new(struct mq_schema *s);
+void mq_runtime_free(struct mq_runtime *s);
+
+// return 0 if success, otherwise return -1
+int mq_runtime_publish_message(struct mq_runtime *rt, int topic_id, void *msg);// append message to pending queue
+void mq_runtime_dispatch(struct mq_runtime *rt);// dispatch all message in pending queue, dispatched message will be append to dlq
+void mq_runtime_clean(struct mq_runtime *rt); // free all message in dlq and pending queue, during this period, publish will be disabled
#ifdef __cplusplus
}