| <?xml version="1.0" encoding="utf-8"?> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| "DTD/xhtml1-strict.dtd"> |
| <html> |
| |
| |
| <head> |
| |
| <title>pulsar.Consumer</title> |
| <meta name="generator" content="pydoctor 25.4.0"> |
| |
| </meta> |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" /> |
| <link rel="stylesheet" type="text/css" href="apidocs.css" /> |
| <link rel="stylesheet" type="text/css" href="readthedocstheme.css" /> |
| <link rel="stylesheet" type="text/css" href="extra.css" /> |
| |
| </head> |
| |
| <body> |
| |
| |
| |
| <nav class="navbar navbar-default mainnavbar"> |
| |
| |
| <div class="container-fluid"> |
| |
| |
| <div class="navbar-header"> |
| |
| <div class="navlinks"> |
| <span class="navbar-brand"> |
| _pulsar/pulsar <a href="index.html">API Documentation</a> |
| </span> |
| |
| <a href="moduleIndex.html"> |
| Modules |
| </a> |
| |
| <a href="classIndex.html"> |
| Classes |
| </a> |
| |
| <a href="nameIndex.html"> |
| Names |
| </a> |
| |
| <div id="search-box-container"> |
| <div class="input-group"> |
| <input id="search-box" type="search" name="search-query" placeholder="Search..." aria-label="Search" minlength="2" class="form-control" autocomplete="off" /> |
| |
| <span class="input-group-btn"> |
| <a style="display: none;" class="btn btn-default" id="search-clear-button" title="Clear" onclick="clearSearch()"><img src="fonts/x-circle.svg" alt="Clear" /></a> |
| <a class="btn btn-default" id="apidocs-help-button" title="Help" href="apidocs-help.html"><img src="fonts/info.svg" alt="Help" /></a> |
| </span> |
| </div> |
| </div> |
| |
| </div> |
| |
| <div id="search-results-container" style="display: none;"> |
| |
| <div id="search-buttons"> |
| <span class="label label-default" id="search-docstrings-button"> |
| <label class="checkbox-inline"> |
| <input type="checkbox" id="toggle-search-in-docstrings-checkbox" value="false" onclick="toggleSearchInDocstrings()"> |
| search in docstrings |
| </input> |
| </label> |
| </span> |
| |
| </div> |
| |
| <noscript> |
| <h1>Cannot search: JavaScript is not supported/enabled in your browser.</h1> |
| </noscript> |
| |
| <div id="search-status"> </div> |
| |
| <div class="warning" id="search-warn-box" style="display: none;"> |
| <p class="rst-last"><span id="search-warn"></span></p> |
| </div> |
| |
| <table id="search-results"> |
| <!-- Filled dynamically by JS --> |
| </table> |
| |
| <div style="margin-top: 10px;"> |
| <p>For more information on the search, visit the <a href="apidocs-help.html#rst-search">help page</a>.</p> |
| </div> |
| </div> |
| |
| </div> |
| |
| |
| </div> |
| |
| |
| <!-- Side navigation --> |
| <div class="sidebarcontainer"> |
| <nav class="sidebar"> |
| |
| |
| <div> |
| |
| <div class="thingTitle"> |
| <span>Class</span> |
| <code class="thisobject"><a href="pulsar.Consumer.html" class="internal-link" title="This class"><wbr></wbr>Consumer</a></code> |
| </div> |
| |
| <div> |
| |
| |
| |
| |
| |
| |
| |
| |
| <div class="childrenKindTitle">Methods</div> |
| <ul> |
| |
| <li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#acknowledge" class="internal-link" title="pulsar.Consumer.acknowledge">acknowledge</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#acknowledge_cumulative" class="internal-link" title="pulsar.Consumer.acknowledge_cumulative">acknowledge<wbr></wbr>_cumulative</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#batch_receive" class="internal-link" title="pulsar.Consumer.batch_receive">batch<wbr></wbr>_receive</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#close" class="internal-link" title="pulsar.Consumer.close">close</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#consumer_name" class="internal-link" title="pulsar.Consumer.consumer_name">consumer<wbr></wbr>_name</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#get_last_message_id" class="internal-link" title="pulsar.Consumer.get_last_message_id">get<wbr></wbr>_last<wbr></wbr>_message<wbr></wbr>_id</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#is_connected" class="internal-link" title="pulsar.Consumer.is_connected">is<wbr></wbr>_connected</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#negative_acknowledge" class="internal-link" title="pulsar.Consumer.negative_acknowledge">negative<wbr></wbr>_acknowledge</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#pause_message_listener" class="internal-link" title="pulsar.Consumer.pause_message_listener">pause<wbr></wbr>_message<wbr></wbr>_listener</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#receive" class="internal-link" title="pulsar.Consumer.receive">receive</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#redeliver_unacknowledged_messages" class="internal-link" title="pulsar.Consumer.redeliver_unacknowledged_messages">redeliver<wbr></wbr>_unacknowledged<wbr></wbr>_messages</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#resume_message_listener" class="internal-link" title="pulsar.Consumer.resume_message_listener">resume<wbr></wbr>_message<wbr></wbr>_listener</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#seek" class="internal-link" title="pulsar.Consumer.seek">seek</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#subscription_name" class="internal-link" title="pulsar.Consumer.subscription_name">subscription<wbr></wbr>_name</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#topic" class="internal-link" title="pulsar.Consumer.topic">topic</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="#unsubscribe" class="internal-link" title="pulsar.Consumer.unsubscribe">unsubscribe</a></code> |
| </div> |
| |
| |
| </li> |
| </ul> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </div> |
| </div><div> |
| |
| <div class="thingTitle"> |
| <span>Package</span> |
| <code><a href="pulsar.html" class="internal-link" title="The parent of this class">pulsar</a></code> |
| </div> |
| |
| <div> |
| |
| |
| <div class="childrenKindTitle">Modules</div> |
| <ul> |
| |
| <li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.__about__.html" class="internal-link" title="pulsar.__about__">__about__</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.asyncio.html" class="internal-link" title="pulsar.asyncio">asyncio</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.exceptions.html" class="internal-link" title="pulsar.exceptions">exceptions</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.functions.html" class="internal-link" title="pulsar.functions">functions</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.schema.html" class="internal-link" title="pulsar.schema">schema</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.tableview.html" class="internal-link" title="pulsar.tableview">tableview</a></code> |
| </div> |
| |
| |
| </li> |
| </ul> |
| |
| <div class="childrenKindTitle">Classes</div> |
| <ul> |
| |
| <li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Authentication.html" class="internal-link" title="pulsar.Authentication"><wbr></wbr>Authentication</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.AuthenticationAthenz.html" class="internal-link" title="pulsar.AuthenticationAthenz"><wbr></wbr>Authentication<wbr></wbr>Athenz</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.AuthenticationBasic.html" class="internal-link" title="pulsar.AuthenticationBasic"><wbr></wbr>Authentication<wbr></wbr>Basic</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.AuthenticationOauth2.html" class="internal-link" title="pulsar.AuthenticationOauth2"><wbr></wbr>Authentication<wbr></wbr>Oauth2</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.AuthenticationTLS.html" class="internal-link" title="pulsar.AuthenticationTLS"><wbr></wbr>Authentication<wbr></wbr>TLS</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.AuthenticationToken.html" class="internal-link" title="pulsar.AuthenticationToken"><wbr></wbr>Authentication<wbr></wbr>Token</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Client.html" class="internal-link" title="pulsar.Client"><wbr></wbr>Client</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.ConsoleLogger.html" class="internal-link" title="pulsar.ConsoleLogger"><wbr></wbr>Console<wbr></wbr>Logger</a></code> |
| </div> |
| |
| |
| </li><li class=" thisobject"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Consumer.html" class="internal-link" title="pulsar.Consumer"><wbr></wbr>Consumer</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.ConsumerBatchReceivePolicy.html" class="internal-link" title="pulsar.ConsumerBatchReceivePolicy"><wbr></wbr>Consumer<wbr></wbr>Batch<wbr></wbr>Receive<wbr></wbr>Policy</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.ConsumerDeadLetterPolicy.html" class="internal-link" title="pulsar.ConsumerDeadLetterPolicy"><wbr></wbr>Consumer<wbr></wbr>Dead<wbr></wbr>Letter<wbr></wbr>Policy</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.ConsumerKeySharedPolicy.html" class="internal-link" title="pulsar.ConsumerKeySharedPolicy"><wbr></wbr>Consumer<wbr></wbr>Key<wbr></wbr>Shared<wbr></wbr>Policy</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.CryptoKeyReader.html" class="internal-link" title="pulsar.CryptoKeyReader"><wbr></wbr>Crypto<wbr></wbr>Key<wbr></wbr>Reader</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.FileLogger.html" class="internal-link" title="pulsar.FileLogger"><wbr></wbr>File<wbr></wbr>Logger</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Message.html" class="internal-link" title="pulsar.Message"><wbr></wbr>Message</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.MessageBatch.html" class="internal-link" title="pulsar.MessageBatch"><wbr></wbr>Message<wbr></wbr>Batch</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId"><wbr></wbr>Message<wbr></wbr>Id</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Producer.html" class="internal-link" title="pulsar.Producer"><wbr></wbr>Producer</a></code> |
| </div> |
| |
| |
| </li><li class=""> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.Reader.html" class="internal-link" title="pulsar.Reader"><wbr></wbr>Reader</a></code> |
| </div> |
| |
| |
| </li> |
| </ul> |
| |
| <div class="childrenKindTitle">Functions</div> |
| <ul> |
| |
| <li class="private"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.html#_check_type" class="internal-link" title="pulsar._check_type">_check<wbr></wbr>_type</a></code> |
| </div> |
| |
| |
| </li><li class="private"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.html#_check_type_or_none" class="internal-link" title="pulsar._check_type_or_none">_check<wbr></wbr>_type<wbr></wbr>_or<wbr></wbr>_none</a></code> |
| </div> |
| |
| |
| </li><li class="private"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.html#_listener_wrapper" class="internal-link" title="pulsar._listener_wrapper">_listener<wbr></wbr>_wrapper</a></code> |
| </div> |
| |
| |
| </li><li class="private"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.html#_seek_arg_convert" class="internal-link" title="pulsar._seek_arg_convert">_seek<wbr></wbr>_arg<wbr></wbr>_convert</a></code> |
| </div> |
| |
| |
| </li> |
| </ul> |
| |
| |
| |
| |
| <div class="childrenKindTitle">Variables</div> |
| <ul> |
| |
| <li class="private"> |
| |
| |
| |
| |
| |
| <div class="itemName"><code><a href="pulsar.html#_retype" class="internal-link" title="pulsar._retype">_retype</a></code> |
| </div> |
| |
| |
| </li> |
| </ul> |
| |
| |
| |
| |
| </div> |
| </div> |
| |
| </nav> |
| <!-- No sidebar toggle for read the docs theme, the sidebar is always |
| visible when the screen is width enough. |
| --> |
| </div> |
| |
| </nav> |
| |
| <div class="container-fluid"> |
| |
| <div id="main" class=""> |
| |
| |
| |
| |
| |
| <div class="page-header"> |
| <h1 class="class"><code><code><a href="pulsar.html" class="internal-link">pulsar</a></code><wbr></wbr>.<code><a href="pulsar.Consumer.html" class="internal-link" title="pulsar.Consumer">Consumer</a></code></code></h1> |
| <div id="showPrivate"> |
| <button class="btn btn-link" onclick="togglePrivate()">Toggle Private API</button> |
| </div> |
| </div> |
| |
| <div class="categoryHeader"> |
| class documentation |
| </div> |
| |
| <div class="extrasDocstring"> |
| <p class="class-signature"><code><span class="py-keyword">class</span> <span class="py-defname">Consumer</span>: <a href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1546" class="sourceLink">(source)</a></code></p> |
| <p><a href="classIndex.html#pulsar.Consumer">View In Hierarchy</a></p> |
| </div> |
| |
| <div class="moduleDocstring"> |
| <div><p>Pulsar consumer.</p> |
| <div class="rst-admonition rst-admonition-examples"> |
| <p class="rst-admonition-title rst-first">Examples</p> |
| <pre class="py-doctest"> |
| <span class="py-keyword">import</span> pulsar |
| |
| client = pulsar.Client(<span class="py-string">'pulsar://localhost:6650'</span>) |
| consumer = client.subscribe(<span class="py-string">'my-topic'</span>, <span class="py-string">'my-subscription'</span>) |
| <span class="py-keyword">while</span> <span class="py-builtin">True</span>: |
| msg = consumer.receive() |
| <span class="py-keyword">try</span>: |
| <span class="py-builtin">print</span>(<span class="py-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id())) |
| consumer.acknowledge(msg) |
| <span class="py-keyword">except</span> <span class="py-builtin">Exception</span>: |
| consumer.negative_acknowledge(msg) |
| client.close()</pre></div> |
| </div> |
| </div> |
| |
| <div id="splitTables"> |
| <table class="children sortable" id="id71"> |
| |
| |
| <tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#acknowledge" class="internal-link" title="pulsar.Consumer.acknowledge">acknowledge</a></code></td> |
| <td>Acknowledge the reception of a single message.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#acknowledge_cumulative" class="internal-link" title="pulsar.Consumer.acknowledge_cumulative">acknowledge<wbr></wbr>_cumulative</a></code></td> |
| <td>Acknowledge the reception of all the messages in the stream up to (and including) the provided message.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#batch_receive" class="internal-link" title="pulsar.Consumer.batch_receive">batch<wbr></wbr>_receive</a></code></td> |
| <td>Batch receiving messages.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#close" class="internal-link" title="pulsar.Consumer.close">close</a></code></td> |
| <td>Close the consumer.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#consumer_name" class="internal-link" title="pulsar.Consumer.consumer_name">consumer<wbr></wbr>_name</a></code></td> |
| <td>Return the consumer name.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#get_last_message_id" class="internal-link" title="pulsar.Consumer.get_last_message_id">get<wbr></wbr>_last<wbr></wbr>_message<wbr></wbr>_id</a></code></td> |
| <td>Get the last message id.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#is_connected" class="internal-link" title="pulsar.Consumer.is_connected">is<wbr></wbr>_connected</a></code></td> |
| <td>Check if the consumer is connected or not.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#negative_acknowledge" class="internal-link" title="pulsar.Consumer.negative_acknowledge">negative<wbr></wbr>_acknowledge</a></code></td> |
| <td>Acknowledge the failure to process a single message.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#pause_message_listener" class="internal-link" title="pulsar.Consumer.pause_message_listener">pause<wbr></wbr>_message<wbr></wbr>_listener</a></code></td> |
| <td>Pause receiving messages via the <tt class="rst-docutils rst-literal">message_listener</tt> until <code><a href="pulsar.Consumer.html#resume_message_listener" class="internal-link" title="pulsar.Consumer.resume_message_listener">resume_message_listener()</a></code> is called.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#receive" class="internal-link" title="pulsar.Consumer.receive">receive</a></code></td> |
| <td>Receive a single message.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#redeliver_unacknowledged_messages" class="internal-link" title="pulsar.Consumer.redeliver_unacknowledged_messages">redeliver<wbr></wbr>_unacknowledged<wbr></wbr>_messages</a></code></td> |
| <td>Redelivers all the unacknowledged messages. In failover mode, the request is ignored if the consumer is not active for the given topic. In shared mode, the consumer's messages to be redelivered are distributed across all the connected consumers...</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#resume_message_listener" class="internal-link" title="pulsar.Consumer.resume_message_listener">resume<wbr></wbr>_message<wbr></wbr>_listener</a></code></td> |
| <td>Resume receiving the messages via the message listener. Asynchronously receive all the messages enqueued from the time <code><a href="pulsar.Consumer.html#pause_message_listener" class="internal-link" title="pulsar.Consumer.pause_message_listener">pause_message_listener()</a></code> was called.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#seek" class="internal-link" title="pulsar.Consumer.seek">seek</a></code></td> |
| <td>Reset the subscription associated with this consumer to a specific message id or publish timestamp. The message id can either be a specific message or represent the first or last messages in the topic. ...</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#subscription_name" class="internal-link" title="pulsar.Consumer.subscription_name">subscription<wbr></wbr>_name</a></code></td> |
| <td>Return the subscription name.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#topic" class="internal-link" title="pulsar.Consumer.topic">topic</a></code></td> |
| <td>Return the topic this consumer is subscribed to.</td> |
| </tr><tr class="method"> |
| |
| <td>Method</td> |
| <td><code><a href="#unsubscribe" class="internal-link" title="pulsar.Consumer.unsubscribe">unsubscribe</a></code></td> |
| <td>Unsubscribe the current consumer from the topic.</td> |
| </tr> |
| </table> |
| |
| |
| |
| </div> |
| |
| <div id="childList"> |
| <div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.acknowledge"> |
| |
| </a> |
| <a name="acknowledge"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">acknowledge</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span>, </span><span class="rst-sig-param">message: <code><a href="pulsar.Message.html" class="internal-link" title="pulsar.Message">Message</a> | <a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a> | <a href="_pulsar.Message.html" class="internal-link" title="_pulsar.Message">_pulsar.Message</a> | <a href="_pulsar.MessageId.html" class="internal-link" title="_pulsar.MessageId">_pulsar.MessageId</a></code></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1638"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#acknowledge" title="pulsar.Consumer.acknowledge"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Acknowledge the reception of a single message.</p> |
| <p>This method will block until an acknowledgement is sent to the broker. |
| After that, the message will not be re-delivered to this consumer.</p> |
| <table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Parameters</td></tr><tr><td class="fieldArgContainer"><span class="fieldArg">message:</span><code><a href="pulsar.Message.html" class="internal-link" title="pulsar.Message">Message</a></code>, <code><a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a></code>, <code><a href="_pulsar.Message.html" class="internal-link">_pulsar.Message</a></code>, <code><a href="_pulsar.MessageId.html" class="internal-link">_pulsar.MessageId</a></code></td><td class="fieldArgDesc">The received message or message id.</td></tr></table><table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Raises</td></tr><tr><td class="fieldArgContainer"><code><a href="_pulsar.OperationNotSupported.html" class="internal-link" title="_pulsar.OperationNotSupported">OperationNotSupported</a></code></td><td>if <tt class="rst-docutils rst-literal">message</tt> is not allowed to acknowledge</td></tr></table></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.acknowledge_cumulative"> |
| |
| </a> |
| <a name="acknowledge_cumulative"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">acknowledge_cumulative</span><span class="function-signature long-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span>, </span><span class="rst-sig-param">message: <code><a href="pulsar.Message.html" class="internal-link" title="pulsar.Message">Message</a> | <a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a> | <a href="_pulsar.Message.html" class="internal-link" title="_pulsar.Message">_pulsar.Message</a> | <a href="_pulsar.MessageId.html" class="internal-link" title="_pulsar.MessageId">_pulsar.MessageId</a></code></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1662"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#acknowledge_cumulative" title="pulsar.Consumer.acknowledge_cumulative"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Acknowledge the reception of all the messages in the stream up to (and |
| including) the provided message.</p> |
| <p>This method will block until an acknowledgement is sent to the broker. |
| After that, the messages will not be re-delivered to this consumer.</p> |
| <table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Parameters</td></tr><tr><td class="fieldArgContainer"><span class="fieldArg">message:</span><code><a href="pulsar.Message.html" class="internal-link" title="pulsar.Message">Message</a> | <a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a> | <a href="_pulsar.Message.html" class="internal-link" title="_pulsar.Message">_pulsar.Message</a> | <a href="_pulsar.MessageId.html" class="internal-link" title="_pulsar.MessageId">_pulsar.MessageId</a></code></td><td class="fieldArgDesc">The received message or message id.</td></tr></table><table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Raises</td></tr><tr><td class="fieldArgContainer"><code><a href="_pulsar.CumulativeAcknowledgementNotAllowedError.html" class="internal-link" title="_pulsar.CumulativeAcknowledgementNotAllowedError">CumulativeAcknowledgementNotAllowedError</a></code></td><td>if the consumer type is ConsumerType.KeyShared or ConsumerType.Shared</td></tr></table></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.batch_receive"> |
| |
| </a> |
| <a name="batch_receive"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">batch_receive</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1623"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#batch_receive" title="pulsar.Consumer.batch_receive"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Batch receiving messages.</p> |
| <p>This calls blocks until has enough messages or wait timeout, more details to see <a class="rst-external rst-reference" href="mailto:{@link" target="_top">{@link</a> BatchReceivePolicy}.</p> |
| </div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.close"> |
| |
| </a> |
| <a name="close"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">close</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1749"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#close" title="pulsar.Consumer.close"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Close the consumer.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.consumer_name"> |
| |
| </a> |
| <a name="consumer_name"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">consumer_name</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1581"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#consumer_name" title="pulsar.Consumer.consumer_name"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Return the consumer name.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.get_last_message_id"> |
| |
| </a> |
| <a name="get_last_message_id"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">get_last_message_id</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1762"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#get_last_message_id" title="pulsar.Consumer.get_last_message_id"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Get the last message id.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.is_connected"> |
| |
| </a> |
| <a name="is_connected"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">is_connected</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1756"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#is_connected" title="pulsar.Consumer.is_connected"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Check if the consumer is connected or not.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.negative_acknowledge"> |
| |
| </a> |
| <a name="negative_acknowledge"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">negative_acknowledge</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span>, </span><span class="rst-sig-param">message</span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1688"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#negative_acknowledge" title="pulsar.Consumer.negative_acknowledge"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Acknowledge the failure to process a single message.</p> |
| <p>When a message is "negatively acked" it will be marked for redelivery after |
| some fixed delay. The delay is configurable when constructing the consumer |
| with <a class="rst-external rst-reference" href="mailto:{@link" target="_top">{@link</a> ConsumerConfiguration#setNegativeAckRedeliveryDelayMs}.</p> |
| <p>This call is not blocking.</p> |
| <table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Parameters</td></tr><tr><td class="fieldArgContainer"><span class="fieldArg">message</span></td><td class="fieldArgDesc">The received message or message id.</td></tr></table></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.pause_message_listener"> |
| |
| </a> |
| <a name="pause_message_listener"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">pause_message_listener</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1709"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#pause_message_listener" title="pulsar.Consumer.pause_message_listener"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Pause receiving messages via the <tt class="rst-docutils rst-literal">message_listener</tt> until <code><a href="#resume_message_listener" class="internal-link" title="pulsar.Consumer.resume_message_listener">resume_message_listener()</a></code> is called.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.receive"> |
| |
| </a> |
| <a name="receive"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">receive</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span>, </span><span class="rst-sig-param">timeout_millis=<a href="https://docs.python.org/3/library/constants.html#None" class="intersphinx-link">None</a></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1599"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#receive" title="pulsar.Consumer.receive"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Receive a single message.</p> |
| <p>If a message is not immediately available, this method will block until |
| a new message is available.</p> |
| <table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Parameters</td></tr><tr><td class="fieldArgContainer"><span class="fieldArg">timeout<wbr></wbr>_millis:</span><code><a href="https://docs.python.org/3/library/functions.html#int" class="intersphinx-link">int</a></code>, <em>optional</em></td><td class="fieldArgDesc">If specified, the receiver will raise an exception if a message is not available within the timeout.</td></tr></table></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.redeliver_unacknowledged_messages"> |
| |
| </a> |
| <a name="redeliver_unacknowledged_messages"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">redeliver_unacknowledged_messages</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1723"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#redeliver_unacknowledged_messages" title="pulsar.Consumer.redeliver_unacknowledged_messages"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Redelivers all the unacknowledged messages. In failover mode, the |
| request is ignored if the consumer is not active for the given topic. In |
| shared mode, the consumer's messages to be redelivered are distributed |
| across all the connected consumers. This is a non-blocking call and |
| doesn't throw an exception. In case the connection breaks, the messages |
| are redelivered after reconnect.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.resume_message_listener"> |
| |
| </a> |
| <a name="resume_message_listener"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">resume_message_listener</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1715"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#resume_message_listener" title="pulsar.Consumer.resume_message_listener"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Resume receiving the messages via the message listener. |
| Asynchronously receive all the messages enqueued from the time |
| <code><a href="#pause_message_listener" class="internal-link" title="pulsar.Consumer.pause_message_listener">pause_message_listener()</a></code> was called.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.seek"> |
| |
| </a> |
| <a name="seek"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">seek</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span>, </span><span class="rst-sig-param">messageid: <code><a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a> | <a href="_pulsar.MessageId.html" class="internal-link" title="_pulsar.MessageId">_pulsar.MessageId</a> | <a href="https://docs.python.org/3/library/functions.html#int" class="intersphinx-link">int</a></code></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1734"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#seek" title="pulsar.Consumer.seek"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Reset the subscription associated with this consumer to a specific message id or publish timestamp. |
| The message id can either be a specific message or represent the first or last messages in the topic. |
| Note: this operation can only be done on non-partitioned topics. For these, one can rather perform the |
| seek() on the individual partitions.</p><table class="fieldTable"><tr class="fieldStart"><td class="fieldName" colspan="2">Parameters</td></tr><tr><td class="fieldArgContainer"><span class="fieldArg">messageid:</span><code><a href="pulsar.MessageId.html" class="internal-link" title="pulsar.MessageId">MessageId</a></code>, <code><a href="_pulsar.MessageId.html" class="internal-link">_pulsar.MessageId</a></code> or <code><a href="https://docs.python.org/3/library/functions.html#int" class="intersphinx-link">int</a></code></td><td class="fieldArgDesc">The message id for seek, OR an integer event time to seek to</td></tr></table></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.subscription_name"> |
| |
| </a> |
| <a name="subscription_name"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">subscription_name</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1575"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#subscription_name" title="pulsar.Consumer.subscription_name"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Return the subscription name.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.topic"> |
| |
| </a> |
| <a name="topic"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">topic</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1569"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#topic" title="pulsar.Consumer.topic"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Return the topic this consumer is subscribed to.</p></div> |
| </div> |
| </div><div class="basemethod"> |
| |
| |
| <a name="pulsar.Consumer.unsubscribe"> |
| |
| </a> |
| <a name="unsubscribe"> |
| |
| </a> |
| <div class="functionHeader"> |
| |
| |
| <span class="py-keyword">def</span> <span class="py-defname">unsubscribe</span><span class="function-signature">(<span class="rst-sig-param"><span class="rst-undocumented">self</span></span>):</span> |
| <a class="sourceLink" href="https://github.com/apache/pulsar-client-python/tree/v3.8.0/pulsar/__init__.py#L1587"> |
| |
| (source) |
| </a> |
| <a class="headerLink" href="#unsubscribe" title="pulsar.Consumer.unsubscribe"> |
| |
| |
| ¶ |
| </a> |
| </div> |
| <div class="docstring functionBody"> |
| |
| <div><p>Unsubscribe the current consumer from the topic.</p> |
| <p>This method will block until the operation is completed. Once the |
| consumer is unsubscribed, no more messages will be received and |
| subsequent new messages will not be retained for this consumer.</p> |
| <p>This consumer object cannot be reused.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| |
| <footer class="navbar navbar-default"> |
| <hr /> |
| |
| |
| <div class="container-fluid"> |
| <a href="index.html">API Documentation</a> for _pulsar/pulsar, |
| generated by <a href="https://github.com/twisted/pydoctor/">pydoctor</a> |
| 25.4.0 at 2025-07-19 14:22:25. |
| </div> |
| |
| <script src="ajax.js" type="text/javascript"></script> |
| <script src="searchlib.js" type="text/javascript"></script> |
| <script src="search.js" type="text/javascript"></script> |
| |
| </footer> |
| |
| <script src="pydoctor.js" type="text/javascript"></script> |
| |
| </body> |
| </html> |