pswamp.streaming.kafka_extras.consumer_producer

Attributes

bootstrap_servers

Classes

KafkaConsumer

Wrapper for Kafka consumer.

KafkaProducer

Wrapper for Kafka producer.

Functions

consumer_seek_relative_offset(consumer, relative_offset)

Module Contents

pswamp.streaming.kafka_extras.consumer_producer.consumer_seek_relative_offset(consumer, relative_offset)
class pswamp.streaming.kafka_extras.consumer_producer.KafkaConsumer(*args, use_nqkafka=False, **kwargs)

Wrapper for Kafka consumer.

Parameters:
  • use_nqkafka (bool, optional) – Determines whether self.instance is a NQKafkaConsumer (from the nqkafka package, can be thought of as a “mock”) or actual KafkaConsumer (from the kafka-python package), which connects to a Kafka server. Defaults to False.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

instance

Determined from input parameters.

Type:

nqkafka.NQKafkaConsumer or kafka.KafkaConsumer

instance
__getattr__(name)

Inherits the same attributes as the instance.

Parameters:

name (_type_) – Name of the attribute.

Returns:

The attribute of the instance.

__iter__()

The iterator is the same as the iterator of the instance.

Returns:

The instance.

class pswamp.streaming.kafka_extras.consumer_producer.KafkaProducer(*args, use_nqkafka=False, **kwargs)

Wrapper for Kafka producer.

Parameters:
  • use_nqkafka (bool, optional) – Determines whether self.instance is a NQKafkaProducer (from the nqkafka package, can be thought of as a “mock”) or actual KafkaProducer (from the kafka-python package), which connects to a Kafka server. Defaults to False.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

instance

Determined from input parameters.

Type:

nqkafka.NQKafkaProducer or kafka.KafkaProducer

instance
__getattr__(name)

Inherits the same attributes as the instance.

Parameters:

name (_type_) – Name of the attribute.

Returns:

The attribute of the instance.

__iter__()

The iterator is the same as the iterator of the instance.

Returns:

The instance.

pswamp.streaming.kafka_extras.consumer_producer.bootstrap_servers = 'localhost:9092'