class documentation

The Pulsar message consumer, used to subscribe to messages from a topic.

Method __init__ Create the consumer. Users should not call this constructor directly. Instead, create the consumer via Client.subscribe.
Async Method acknowledge Acknowledge the reception of a single message asynchronously.
Async Method acknowledge_cumulative Acknowledge the reception of all the messages in the stream up to (and including) the provided message asynchronously.
Async Method close Close the consumer asynchronously.
Method consumer_name Return the consumer name.
Async Method receive Receive a single message asynchronously.
Async Method seek Reset the subscription associated with this consumer to a specific message id or publish timestamp asynchronously.
Method subscription_name Return the subscription name.
Method topic Return the topic this consumer is subscribed to.
Async Method unsubscribe Unsubscribe the current consumer from the topic asynchronously.
Instance Variable _consumer Undocumented
Instance Variable _schema Undocumented
def __init__(self, consumer: _pulsar.Consumer, schema: pulsar.schema.Schema): (source)

Create the consumer. Users should not call this constructor directly. Instead, create the consumer via Client.subscribe.

Parameters
consumer:_pulsar.ConsumerThe underlying Consumer object from the C extension.
schema:pulsar.schema.SchemaThe schema of the data that will be received by this consumer.

Acknowledge the reception of a single message asynchronously.

Parameters
message:Message, MessageId, _pulsar.Message, _pulsar.MessageIdThe received message or message id.
Raises
PulsarException
async def acknowledge_cumulative(self, message: pulsar.Message | pulsar.MessageId | _pulsar.Message | _pulsar.MessageId): (source)

Acknowledge the reception of all the messages in the stream up to (and including) the provided message asynchronously.

Parameters
message:Message, MessageId, _pulsar.Message, _pulsar.MessageIdThe received message or message id.
Raises
PulsarException
async def close(self): (source)

Close the consumer asynchronously.

Raises
PulsarException
def consumer_name(self) -> str: (source)

Return the consumer name.

async def receive(self) -> pulsar.Message: (source)

Receive a single message asynchronously.

Returns
pulsar.MessageThe message received.
Raises
PulsarException
async def seek(self, messageid: pulsar.MessageId | int): (source)

Reset the subscription associated with this consumer to a specific message id or publish timestamp asynchronously.

The message id can either be a specific message or represent the first or last messages in the topic.

Parameters
messageid:MessageId or intThe message id for seek, OR an integer event time (timestamp) to seek to
Raises
PulsarException
def subscription_name(self) -> str: (source)

Return the subscription name.

def topic(self) -> str: (source)

Return the topic this consumer is subscribed to.

async def unsubscribe(self): (source)

Unsubscribe the current consumer from the topic asynchronously.

Raises
PulsarException
_consumer = (source)

Undocumented

Undocumented