Producer.produce

Produce and send a single message to broker.

This is an asynch non-blocking API.

\p partition is the target partition, either: - Topic::PARTITION_UA (unassigned) for automatic partitioning using the topic's partitioner function, or - a fixed partition (0..N)

\p msgflags is zero or more of the following flags OR:ed together: block - block \p produce*() call if \p queue.buffering.max.messages or \p queue.buffering.max.kbytes are exceeded. Messages are considered in-queue from the point they are accepted by produce() until their corresponding delivery report callback/event returns. It is thus a requirement to call poll() (or equiv.) from a separate thread when block is used. See WARNING on \c block above. free - rdkafka will free(3) \p payload when it is done with it. copy - the \p payload data will be copied and the \p payload pointer will not be used by rdkafka after the call returns.

NOTE: free and copy are mutually exclusive.

If the function returns -1 and free was specified, then the memory associated with the payload is still the caller's responsibility.

\p payload is the message payload of size \p len bytes.

\p key is an optional message key, if non-null it will be passed to the topic partitioner as well as be sent with the message to the broker and passed on to the consumer.

\p msg_opaque is an optional application-provided per-message opaque pointer that will provided in the delivery report callback (\p dr_cb) for referencing this message.

an ErrorCode to indicate success or failure: - _QUEUE_FULL - maximum number of outstanding messages has been reached: \c queue.buffering.max.message

- MSG_SIZE_TOO_LARGE - message is larger than configured max size: \c messages.max.bytes

- _UNKNOWN_PARTITION - requested \p partition is unknown in the Kafka cluster.

- _UNKNOWN_TOPIC - topic is unknown in the Kafka cluster.

class Producer
nothrow @nogc
produce
(
Topic topic
,,
void[] payload
,
const(void)[] key = null
,
long timestamp = Clock.currTime(UTC()).toUnixTime!long
,,
void* msg_opaque = null
)

Meta