The Apache Kafka C/C++ client library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RdKafka::Queue Class Referenceabstract

Queue interface. More...

#include <rdkafkacpp.h>

Public Member Functions

virtual ErrorCode forward (Queue *dst)=0
 Forward/re-route queue to dst. If dst is NULL, the forwarding is removed. More...
virtual Messageconsume (int timeout_ms)=0
 Consume message or get error event from the queue. More...
virtual int poll (int timeout_ms)=0
 Poll queue, serving any enqueued callbacks. More...
virtual void io_event_enable (int fd, const void *payload, size_t size)=0
 Enable IO event triggering for queue. More...

Static Public Member Functions

static Queuecreate (Handle *handle)
 Create Queue object.

Detailed Description

Queue interface.

Create a new message queue. Message queues allows the application to re-route consumed messages from multiple topic+partitions into one single queue point. This queue point, containing messages from a number of topic+partitions, may then be served by a single consume() method, rather than one per topic+partition combination.

See the RdKafka::Consumer::start(), RdKafka::Consumer::consume(), and RdKafka::Consumer::consume_callback() methods that take a queue as the first parameter for more information.

Member Function Documentation

virtual ErrorCode RdKafka::Queue::forward ( Queue dst)
pure virtual

Forward/re-route queue to dst. If dst is NULL, the forwarding is removed.

The internal refcounts for both queues are increased.

Regardless of whether dst is NULL or not, after calling this function, src will not forward it's fetch queue to the consumer queue.
virtual Message* RdKafka::Queue::consume ( int  timeout_ms)
pure virtual

Consume message or get error event from the queue.

Use delete to free the message.
One of:
virtual int RdKafka::Queue::poll ( int  timeout_ms)
pure virtual

Poll queue, serving any enqueued callbacks.

Must NOT be used for queues containing messages.
the number of events served or 0 on timeout.
virtual void RdKafka::Queue::io_event_enable ( int  fd,
const void *  payload,
size_t  size 
pure virtual

Enable IO event triggering for queue.

To ease integration with IO based polling loops this API allows an application to create a separate file-descriptor that librdkafka will write payload (of size size) to whenever a new element is enqueued on a previously empty queue.

To remove event triggering call with fd = -1.

librdkafka will maintain a copy of the payload.

When using forwarded queues the IO event must only be enabled on the final forwarded-to (destination) queue.

The documentation for this class was generated from the following file: