Skip to content

Optimal scenario for a long-living producer with/without delivery-callback #3839

Answered by edenhill
SoulfreezerXP asked this question in Q&A
Discussion options

You must be logged in to vote

If you don't register any callbacks (dr_msg_cb, error_cb, stats_cb, etc) then you don't need to call poll().

But not having a delivery report callback (dr_msg_cb) means you will have no way of knowing if your messages were successfully produced or not, which is effectively equivalent to not produce():ing the messages at all - in drastical terms - so we highly advice against this approach.

As for poll() overhead; you don't need to call it once for each message produced, in practice you only need to call it when produce() returns ERR__QUEUE_FULL, but that will delay error reporting until the queue is full, so I'd recommend calling poll() once per second or every N messages produce()d.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@edenhill
Comment options

@SoulfreezerXP
Comment options

Answer selected by SoulfreezerXP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants