You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/03/07 08:59:45 UTC
[pulsar] branch asf-site updated: Updated site at revision fd05219
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 1419306 Updated site at revision fd05219
1419306 is described below
commit 1419306e79842dd5f91e755db5afef98982d09f4
Author: jenkins <bu...@apache.org>
AuthorDate: Thu Mar 7 08:59:36 2019 +0000
Updated site at revision fd05219
---
content/docs/en/next/client-libraries-go.html | 16 ++++++++--
.../docs/en/next/client-libraries-go/index.html | 16 ++++++++--
content/docs/en/next/client-libraries-java.html | 19 ++++++++----
.../docs/en/next/client-libraries-java/index.html | 19 ++++++++----
content/docs/en/next/client-libraries-python.html | 18 ++++++++---
.../en/next/client-libraries-python/index.html | 18 ++++++++---
content/docs/en/next/reference-terminology.html | 4 +++
.../docs/en/next/reference-terminology/index.html | 4 +++
content/docs/fr/next/client-libraries-go.html | 16 ++++++++--
.../docs/fr/next/client-libraries-go/index.html | 16 ++++++++--
content/docs/fr/next/client-libraries-java.html | 18 +++++++----
.../docs/fr/next/client-libraries-java/index.html | 18 +++++++----
content/docs/fr/next/client-libraries-python.html | 18 ++++++++---
.../fr/next/client-libraries-python/index.html | 18 ++++++++---
content/docs/fr/next/reference-terminology.html | 2 ++
.../docs/fr/next/reference-terminology/index.html | 2 ++
content/docs/ja/next/client-libraries-go.html | 16 ++++++++--
.../docs/ja/next/client-libraries-go/index.html | 16 ++++++++--
content/docs/ja/next/client-libraries-java.html | 18 +++++++----
.../docs/ja/next/client-libraries-java/index.html | 18 +++++++----
content/docs/ja/next/client-libraries-python.html | 18 ++++++++---
.../ja/next/client-libraries-python/index.html | 18 ++++++++---
content/docs/ja/next/reference-terminology.html | 2 ++
.../docs/ja/next/reference-terminology/index.html | 2 ++
content/docs/zh-CN/next/client-libraries-go.html | 16 ++++++++--
.../docs/zh-CN/next/client-libraries-go/index.html | 16 ++++++++--
content/docs/zh-CN/next/client-libraries-java.html | 18 +++++++----
.../zh-CN/next/client-libraries-java/index.html | 18 +++++++----
.../docs/zh-CN/next/client-libraries-python.html | 18 ++++++++---
.../zh-CN/next/client-libraries-python/index.html | 18 ++++++++---
content/docs/zh-CN/next/reference-terminology.html | 2 ++
.../zh-CN/next/reference-terminology/index.html | 2 ++
content/swagger/swagger.json | 36 +++++++++++-----------
33 files changed, 352 insertions(+), 122 deletions(-)
diff --git a/content/docs/en/next/client-libraries-go.html b/content/docs/en/next/client-libraries-go.html
index d8b6cf7..7769c65 100644
--- a/content/docs/en/next/client-libraries-go.html
+++ b/content/docs/en/next/client-libraries-go.html
@@ -297,7 +297,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/en/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/en/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/en [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/en [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/en/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/en/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -338,8 +340,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -353,6 +362,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/en/next/client-libraries-go/index.html b/content/docs/en/next/client-libraries-go/index.html
index d8b6cf7..7769c65 100644
--- a/content/docs/en/next/client-libraries-go/index.html
+++ b/content/docs/en/next/client-libraries-go/index.html
@@ -297,7 +297,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/en/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/en/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/en [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/en/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/en [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/en/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/en/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -338,8 +340,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -353,6 +362,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/en/next/client-libraries-java.html b/content/docs/en/next/client-libraries-java.html
index 3977f11..d3f95fd 100644
--- a/content/docs/en/next/client-libraries-java.html
+++ b/content/docs/en/next/client-libraries-java.html
@@ -204,16 +204,23 @@ get a future returned.</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="/docs/en/next/reference-terminology#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="/docs/en/next/reference-terminology#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href= [...]
+to have the message redelivered at a later point in time.</p>
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/en/next/client-libraries-java/index.html b/content/docs/en/next/client-libraries-java/index.html
index 3977f11..d3f95fd 100644
--- a/content/docs/en/next/client-libraries-java/index.html
+++ b/content/docs/en/next/client-libraries-java/index.html
@@ -204,16 +204,23 @@ get a future returned.</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="/docs/en/next/reference-terminology#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="/docs/en/next/reference-terminology#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href= [...]
+to have the message redelivered at a later point in time.</p>
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/en/next/client-libraries-python.html b/content/docs/en/next/client-libraries-python.html
index d7ad759..4290395 100644
--- a/content/docs/en/next/client-libraries-python.html
+++ b/content/docs/en/next/client-libraries-python.html
@@ -117,8 +117,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -174,8 +179,13 @@ bytes:</p>
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar.
diff --git a/content/docs/en/next/client-libraries-python/index.html b/content/docs/en/next/client-libraries-python/index.html
index d7ad759..4290395 100644
--- a/content/docs/en/next/client-libraries-python/index.html
+++ b/content/docs/en/next/client-libraries-python/index.html
@@ -117,8 +117,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -174,8 +179,13 @@ bytes:</p>
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar.
diff --git a/content/docs/en/next/reference-terminology.html b/content/docs/en/next/reference-terminology.html
index c1010f6..b5d87bd 100644
--- a/content/docs/en/next/reference-terminology.html
+++ b/content/docs/en/next/reference-terminology.html
@@ -113,6 +113,10 @@ available unacked message);</li>
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed.
An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system;
if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar
+to signal that the message should be replayed at a later timer. (By default, failed messages are
+replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/en/next/reference-terminology/index.html b/content/docs/en/next/reference-terminology/index.html
index c1010f6..b5d87bd 100644
--- a/content/docs/en/next/reference-terminology/index.html
+++ b/content/docs/en/next/reference-terminology/index.html
@@ -113,6 +113,10 @@ available unacked message);</li>
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed.
An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system;
if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar
+to signal that the message should be replayed at a later timer. (By default, failed messages are
+replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/fr/next/client-libraries-go.html b/content/docs/fr/next/client-libraries-go.html
index 5d2a70c..65cb066 100644
--- a/content/docs/fr/next/client-libraries-go.html
+++ b/content/docs/fr/next/client-libraries-go.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/fr/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/fr/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/fr [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/fr [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/fr/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/fr/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/fr/next/client-libraries-go/index.html b/content/docs/fr/next/client-libraries-go/index.html
index 5d2a70c..65cb066 100644
--- a/content/docs/fr/next/client-libraries-go/index.html
+++ b/content/docs/fr/next/client-libraries-go/index.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/fr/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/fr/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/fr [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/fr/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/fr [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/fr/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/fr/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/fr/next/client-libraries-java.html b/content/docs/fr/next/client-libraries-java.html
index a6aebbc..a37e7ab 100644
--- a/content/docs/fr/next/client-libraries-java.html
+++ b/content/docs/fr/next/client-libraries-java.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference- [...]
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/fr/next/client-libraries-java/index.html b/content/docs/fr/next/client-libraries-java/index.html
index a6aebbc..a37e7ab 100644
--- a/content/docs/fr/next/client-libraries-java/index.html
+++ b/content/docs/fr/next/client-libraries-java/index.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference- [...]
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/fr/next/client-libraries-python.html b/content/docs/fr/next/client-libraries-python.html
index b755c30..4e93435 100644
--- a/content/docs/fr/next/client-libraries-python.html
+++ b/content/docs/fr/next/client-libraries-python.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/fr/next/client-libraries-python/index.html b/content/docs/fr/next/client-libraries-python/index.html
index b755c30..4e93435 100644
--- a/content/docs/fr/next/client-libraries-python/index.html
+++ b/content/docs/fr/next/client-libraries-python/index.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/fr/next/reference-terminology.html b/content/docs/fr/next/reference-terminology.html
index 942553e..3f5102a 100644
--- a/content/docs/fr/next/reference-terminology.html
+++ b/content/docs/fr/next/reference-terminology.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/fr/next/reference-terminology/index.html b/content/docs/fr/next/reference-terminology/index.html
index 942553e..3f5102a 100644
--- a/content/docs/fr/next/reference-terminology/index.html
+++ b/content/docs/fr/next/reference-terminology/index.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/ja/next/client-libraries-go.html b/content/docs/ja/next/client-libraries-go.html
index cb23b36..fb4f4df 100644
--- a/content/docs/ja/next/client-libraries-go.html
+++ b/content/docs/ja/next/client-libraries-go.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/ja/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/ja/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/ja [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/ja [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/ja/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/ja/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/ja/next/client-libraries-go/index.html b/content/docs/ja/next/client-libraries-go/index.html
index cb23b36..fb4f4df 100644
--- a/content/docs/ja/next/client-libraries-go/index.html
+++ b/content/docs/ja/next/client-libraries-go/index.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/ja/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/ja/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/ja [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/ja/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs/ja [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/ja/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/ja/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</strong>: [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/ja/next/client-libraries-java.html b/content/docs/ja/next/client-libraries-java.html
index 95da578..15d5d0d 100644
--- a/content/docs/ja/next/client-libraries-java.html
+++ b/content/docs/ja/next/client-libraries-java.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference- [...]
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/ja/next/client-libraries-java/index.html b/content/docs/ja/next/client-libraries-java/index.html
index 95da578..15d5d0d 100644
--- a/content/docs/ja/next/client-libraries-java/index.html
+++ b/content/docs/ja/next/client-libraries-java/index.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p>The <code>subscribe</code> method will automatically subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a <code>while</code> loop. In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference- [...]
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="configuring-consumers"></a><a href="#configuring-consumers" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2 [...]
<p>If you instantiate a <code>Consumer</code> object specifying only a topic and subscription name, as in the example above, the consumer will use the default configuration. To use a non-default configuration, there's a variety of configurable parameters that you can set. For a full listing, see the Javadoc for the <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/ja/next/client-libraries-python.html b/content/docs/ja/next/client-libraries-python.html
index 09344a5..a518a40 100644
--- a/content/docs/ja/next/client-libraries-python.html
+++ b/content/docs/ja/next/client-libraries-python.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/ja/next/client-libraries-python/index.html b/content/docs/ja/next/client-libraries-python/index.html
index 09344a5..a518a40 100644
--- a/content/docs/ja/next/client-libraries-python/index.html
+++ b/content/docs/ja/next/client-libraries-python/index.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/ja/next/reference-terminology.html b/content/docs/ja/next/reference-terminology.html
index 183ccf5..2140b7d 100644
--- a/content/docs/ja/next/reference-terminology.html
+++ b/content/docs/ja/next/reference-terminology.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/ja/next/reference-terminology/index.html b/content/docs/ja/next/reference-terminology/index.html
index 183ccf5..2140b7d 100644
--- a/content/docs/ja/next/reference-terminology/index.html
+++ b/content/docs/ja/next/reference-terminology/index.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/zh-CN/next/client-libraries-go.html b/content/docs/zh-CN/next/client-libraries-go.html
index 39ff1b2..8846ef6 100644
--- a/content/docs/zh-CN/next/client-libraries-go.html
+++ b/content/docs/zh-CN/next/client-libraries-go.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/zh-CN/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/zh-CN/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/zh-CN/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/zh-CN/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</str [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/zh-CN/next/client-libraries-go/index.html b/content/docs/zh-CN/next/client-libraries-go/index.html
index 39ff1b2..8846ef6 100644
--- a/content/docs/zh-CN/next/client-libraries-go/index.html
+++ b/content/docs/zh-CN/next/client-libraries-go/index.html
@@ -295,7 +295,9 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>Receive(context.Context)</code></td><td style="text-align:left">Receives a single message from the topic. This method blocks until a message is available.</td><td style="text-align:left"><code>(Message, error)</code></td></tr>
<tr><td style="text-align:left"><code>Ack(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/zh-CN/next/reference-terminology#broker">broker</a></td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>AckID(MessageID)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> a message to the Pulsar <a href="/docs/zh-CN/next/reference-terminology#broker">broker</a> by message ID</td><td style="text-align:left"><code>error</code></td></tr>
-<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs [...]
+<tr><td style="text-align:left"><code>AckCumulative(Message)</code></td><td style="text-align:left"><a href="/docs/zh-CN/next/reference-terminology#acknowledgment-ack">Acknowledges</a> <em>all</em> the messages in the stream, up to and including the specified message. The <code>AckCumulative</code> method will block until the ack has been sent to the broker. After that, the messages will <em>not</em> be redelivered to the consumer. Cumulative acking can only be used with a <a href="/docs [...]
+<tr><td style="text-align:left"><code>Nack(Message)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
+<tr><td style="text-align:left"><code>NackID(MessageID)</code></td><td style="text-align:left">Acknowledge the failure to process a single message.</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>Close()</code></td><td style="text-align:left">Closes the consumer, disabling its ability to receive messages from the broker</td><td style="text-align:left"><code>error</code></td></tr>
<tr><td style="text-align:left"><code>RedeliverUnackedMessages()</code></td><td style="text-align:left">Redelivers <em>all</em> unacknowledged messages on the topic. In <a href="/docs/zh-CN/next/concepts-messaging#failover">failover</a> mode, this request is ignored if the consumer isn't active on the specified topic; in <a href="/docs/zh-CN/next/concepts-messaging#shared">shared</a> mode, redelivered messages are distributed across all consumers connected to the topic. <strong>Note</str [...]
</tbody>
@@ -336,8 +338,15 @@ consumer, err := client.Subscribe(consumerOpts)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> { log.Fatal(err) }
<span class="hljs-comment">// Do something with the message</span>
-
- consumer.Ack(msg)
+ err = processMessage(msg)
+
+ <span class="hljs-keyword">if</span> err == <span class="hljs-literal">nil</span> {
+ <span class="hljs-comment">// Message processed successfully</span>
+ consumer.Ack(msg)
+ } <span class="hljs-keyword">else</span> {
+ <span class="hljs-comment">// Failed to process messages</span>
+ consumer.Nack(msg)
+ }
}
}
</code></pre>
@@ -351,6 +360,7 @@ consumer, err := client.Subscribe(consumerOpts)
<tr><td style="text-align:left"><code>SubscriptionName</code></td><td style="text-align:left">The subscription name for this consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>Name</code></td><td style="text-align:left">The name of the consumer</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>AckTimeout</code></td><td style="text-align:left"></td><td style="text-align:left">0</td></tr>
+<tr><td style="text-align:left"><code>NackRedeliveryDelay</code></td><td style="text-align:left">The delay after which to redeliver the messages that failed to be processed. Default is 1min. (See <code>Consumer.Nack()</code>)</td><td style="text-align:left">1 minute</td></tr>
<tr><td style="text-align:left"><code>SubscriptionType</code></td><td style="text-align:left">Available options are <code>Exclusive</code>, <code>Shared</code>, and <code>Failover</code></td><td style="text-align:left"><code>Exclusive</code></td></tr>
<tr><td style="text-align:left"><code>MessageChannel</code></td><td style="text-align:left">The Go channel used by the consumer. Messages that arrive from the Pulsar topic(s) will be passed to this channel.</td><td style="text-align:left"></td></tr>
<tr><td style="text-align:left"><code>ReceiverQueueSize</code></td><td style="text-align:left">Sets the size of the consumer's receiver queue, i.e. the number of messages that can be accumulated by the consumer before the application calls <code>Receive</code>. A value higher than the default of 1000 could increase consumer throughput, though at the expense of more memory utilization.</td><td style="text-align:left">1000</td></tr>
diff --git a/content/docs/zh-CN/next/client-libraries-java.html b/content/docs/zh-CN/next/client-libraries-java.html
index f94fcf0..451865a 100644
--- a/content/docs/zh-CN/next/client-libraries-java.html
+++ b/content/docs/zh-CN/next/client-libraries-java.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p><code>subscribe</code> 方法将自动将订阅消费者指定的主题和订阅。 一种让消费者监听主题的方法是使用<code>while</code>循环。 在这个循环示例中,消费者监听消息,打印收到的任何消息的内容,然后[确认](reference-terminology. md#acknowledgment-ack)消息已被处理:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p><code>subscribe</code> 方法将自动将订阅消费者指定的主题和订阅。 一种让消费者监听主题的方法是使用<code>while</code>循环。 In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference-terminology.md#acknowledgment-ack">negative acknowledgement</a> to have the message redelivered at a later point in time.</p>
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// 确认消息,以便broker删除消息</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="消费者配置"></a><a href="#消费者配置" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>如果实例化 <code>消费者</code> 对象, 仅指定主题和订阅名称, 如上面的示例所示, 消费者将采用默认配置。 要使用非默认配置, 你可以设置多种可配置的参数。 有关完整列表, 请参阅 <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/zh-CN/next/client-libraries-java/index.html b/content/docs/zh-CN/next/client-libraries-java/index.html
index f94fcf0..451865a 100644
--- a/content/docs/zh-CN/next/client-libraries-java/index.html
+++ b/content/docs/zh-CN/next/client-libraries-java/index.html
@@ -206,16 +206,22 @@ client.close();</p>
.subscriptionName(<span class="hljs-string">"my-subscription"</span>)
.subscribe();
</code></pre>
-<p><code>subscribe</code> 方法将自动将订阅消费者指定的主题和订阅。 一种让消费者监听主题的方法是使用<code>while</code>循环。 在这个循环示例中,消费者监听消息,打印收到的任何消息的内容,然后[确认](reference-terminology. md#acknowledgment-ack)消息已被处理:</p>
-<pre><code class="hljs css language-java"><span class="hljs-keyword">do</span> {
+<p><code>subscribe</code> 方法将自动将订阅消费者指定的主题和订阅。 一种让消费者监听主题的方法是使用<code>while</code>循环。 In this example loop, the consumer listens for messages, prints the contents of any message that's received, and then <a href="reference-terminology.md#acknowledgment-ack">acknowledges</a> that the message has been processed. If the processing logic fails, we use <a href="reference-terminology.md#acknowledgment-ack">negative acknowledgement</a> to have the message redelivered at a later point in time.</p>
+<pre><code class="hljs css language-java"><span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>) {
<span class="hljs-comment">// Wait for a message</span>
Message msg = consumer.receive();
- System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
+ <span class="hljs-keyword">try</span> {
+ <span class="hljs-comment">// Do something with the message</span>
+ System.out.printf(<span class="hljs-string">"Message received: %s"</span>, <span class="hljs-keyword">new</span> String(msg.getData()));
- <span class="hljs-comment">// 确认消息,以便broker删除消息</span>
- consumer.acknowledge(msg);
-} <span class="hljs-keyword">while</span> (<span class="hljs-keyword">true</span>);
+ <span class="hljs-comment">// Acknowledge the message so that it can be deleted by the message broker</span>
+ consumer.acknowledge(msg);
+ } <span class="hljs-keyword">catch</span> (Exception e) {
+ <span class="hljs-comment">// Message failed to process, redeliver later</span>
+ consumer.negativeAcknowledge(msg);
+ }
+}
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="消费者配置"></a><a href="#消费者配置" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>如果实例化 <code>消费者</code> 对象, 仅指定主题和订阅名称, 如上面的示例所示, 消费者将采用默认配置。 要使用非默认配置, 你可以设置多种可配置的参数。 有关完整列表, 请参阅 <a href="https://pulsar.incubator.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder">ConsumerBuilder</a>
diff --git a/content/docs/zh-CN/next/client-libraries-python.html b/content/docs/zh-CN/next/client-libraries-python.html
index 4785457..edfd501 100644
--- a/content/docs/zh-CN/next/client-libraries-python.html
+++ b/content/docs/zh-CN/next/client-libraries-python.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/zh-CN/next/client-libraries-python/index.html b/content/docs/zh-CN/next/client-libraries-python/index.html
index 4785457..edfd501 100644
--- a/content/docs/zh-CN/next/client-libraries-python/index.html
+++ b/content/docs/zh-CN/next/client-libraries-python/index.html
@@ -119,8 +119,13 @@ client.close()
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
- print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
client.close()
</code></pre>
@@ -165,8 +170,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
ex = msg.value()
- print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- consumer.acknowledge(msg)
+ <span class="hljs-keyword">try</span>:
+ print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
+ <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ consumer.acknowledge(msg)
+ <span class="hljs-keyword">except</span>:
+ <span class="hljs-comment"># Message failed to be processed</span>
+ consumer.negative_acknowledge(msg)
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
diff --git a/content/docs/zh-CN/next/reference-terminology.html b/content/docs/zh-CN/next/reference-terminology.html
index df2f261..c4fe62a 100644
--- a/content/docs/zh-CN/next/reference-terminology.html
+++ b/content/docs/zh-CN/next/reference-terminology.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/docs/zh-CN/next/reference-terminology/index.html b/content/docs/zh-CN/next/reference-terminology/index.html
index df2f261..c4fe62a 100644
--- a/content/docs/zh-CN/next/reference-terminology/index.html
+++ b/content/docs/zh-CN/next/reference-terminology/index.html
@@ -104,6 +104,8 @@
<p>The subscription position for a <a href="#consumer">consumer</a>.</p>
<h4><a class="anchor" aria-hidden="true" id="acknowledgment-ack"></a><a href="#acknowledgment-ack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
<p>A message sent to a Pulsar broker by a <a href="#consumer">consumer</a> that a message has been successfully processed. An acknowledgement (ack) is Pulsar's way of knowing that the message can be deleted from the system; if no acknowledgement, then the message will be retained until it's processed.</p>
+<h4><a class="anchor" aria-hidden="true" id="negative-acknowledgment-nack"></a><a href="#negative-acknowledgment-nack" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 [...]
+<p>When an application fails to process a particular message, it can sends a "negative ack" to Pulsar to signal that the message should be replayed at a later timer. (By default, failed messages are replayed after a 1 minute delay)</p>
<h4><a class="anchor" aria-hidden="true" id="unacknowledged"></a><a href="#unacknowledged" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
<p>A message that has been delivered to a consumer for processing but not yet confirmed as processed by the consumer.</p>
<h4><a class="anchor" aria-hidden="true" id="retention-policy"></a><a href="#retention-policy" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
diff --git a/content/swagger/swagger.json b/content/swagger/swagger.json
index 05da8ca..c1a5717 100644
--- a/content/swagger/swagger.json
+++ b/content/swagger/swagger.json
@@ -7096,6 +7096,20 @@
"type" : "number",
"format" : "double"
},
+ "underLoaded" : {
+ "type" : "boolean"
+ },
+ "msgThroughputIn" : {
+ "type" : "number",
+ "format" : "double"
+ },
+ "msgThroughputOut" : {
+ "type" : "number",
+ "format" : "double"
+ },
+ "cpu" : {
+ "$ref" : "#/definitions/ResourceUsage"
+ },
"memory" : {
"$ref" : "#/definitions/ResourceUsage"
},
@@ -7112,25 +7126,11 @@
"type" : "integer",
"format" : "int64"
},
- "msgThroughputIn" : {
- "type" : "number",
- "format" : "double"
- },
- "msgThroughputOut" : {
- "type" : "number",
- "format" : "double"
- },
"overLoaded" : {
"type" : "boolean"
},
"loadReportType" : {
"type" : "string"
- },
- "cpu" : {
- "$ref" : "#/definitions/ResourceUsage"
- },
- "underLoaded" : {
- "type" : "boolean"
}
}
},
@@ -8069,15 +8069,15 @@
"ResourceDescription" : {
"type" : "object",
"properties" : {
- "usagePct" : {
- "type" : "integer",
- "format" : "int32"
- },
"resourceUsage" : {
"type" : "object",
"additionalProperties" : {
"$ref" : "#/definitions/ResourceUsage"
}
+ },
+ "usagePct" : {
+ "type" : "integer",
+ "format" : "int32"
}
}
},