File tree 5 files changed +43
-7
lines changed
5 files changed +43
-7
lines changed Original file line number Diff line number Diff line change @@ -400,8 +400,30 @@ class PULSAR_PUBLIC ConsumerConfiguration {
400
400
const BatchReceivePolicy& getBatchReceivePolicy () const ;
401
401
402
402
/* *
403
- * Set dead letter policy.
404
- *
403
+ * Set dead letter policy for consumer
404
+ *
405
+ * By default some message will redelivery so many times possible, even to the extent that it can be never
406
+ * stop. By using dead letter mechanism messages will has the max redelivery count, when message exceeding
407
+ * the maximum number of redeliveries, message will send to the Dead Letter Topic and acknowledged
408
+ * automatic.
409
+ *
410
+ * You can enable the dead letter mechanism by setting dead letter policy.
411
+ * example:
412
+ *
413
+ * <pre>
414
+ * * DeadLetterPolicy dlqPolicy = DeadLetterPolicyBuilder()
415
+ * .maxRedeliverCount(10)
416
+ * .build();
417
+ * </pre>
418
+ * Default dead letter topic name is {TopicName}-{Subscription}-DLQ.
419
+ * To setting a custom dead letter topic name
420
+ * <pre>
421
+ * DeadLetterPolicy dlqPolicy = DeadLetterPolicyBuilder()
422
+ * .deadLetterTopic("dlq-topic")
423
+ * .maxRedeliverCount(10)
424
+ * .initialSubscriptionName("init-sub-name")
425
+ * .build();
426
+ * </pre>
405
427
* @param deadLetterPolicy thd default is empty
406
428
*/
407
429
void setDeadLetterPolicy (const DeadLetterPolicy& deadLetterPolicy);
Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ class PULSAR_PUBLIC DeadLetterPolicyBuilder {
46
46
DeadLetterPolicyBuilder ();
47
47
48
48
/* *
49
- * Set dead letter topic
49
+ * Set dead letter topic.
50
+ *
51
+ * @param deadLetterTopic Name of the dead topic where the failing messages will be sent.
52
+ * The default value is: sourceTopicName + "-" + subscriptionName + "-DLQ"
50
53
*
51
54
* @return
52
55
*/
@@ -55,13 +58,23 @@ class PULSAR_PUBLIC DeadLetterPolicyBuilder {
55
58
/* *
56
59
* Set max redeliver count
57
60
*
61
+ * @param maxRedeliverCount Maximum number of times that a message will be redelivered before being sent
62
+ * to the dead letter queue.
63
+ * - The maxRedeliverCount must be greater than 0.
64
+ * - The default value is {INT_MAX} (DLQ is not enabled)
65
+ *
58
66
* @return
59
67
*/
60
68
DeadLetterPolicyBuilder& maxRedeliverCount (int maxRedeliverCount);
61
69
62
70
/* *
63
71
* Set initial subscription name
64
72
*
73
+ * @param initialSubscriptionName Name of the initial subscription name of the dead letter topic.
74
+ * If this field is not set, the initial subscription for the dead letter topic will not be created.
75
+ * If this field is set but the broker's `allowAutoSubscriptionCreation` is disabled, the DLQ producer
76
+ * will fail to be created.
77
+ *
65
78
* @return
66
79
*/
67
80
DeadLetterPolicyBuilder& initialSubscriptionName (const std::string& initialSubscriptionName);
Original file line number Diff line number Diff line change 18
18
*/
19
19
#pragma once
20
20
21
- #include " climits"
22
- #include " string"
21
+ #include < climits>
22
+ #include < string>
23
23
24
24
namespace pulsar {
25
25
Original file line number Diff line number Diff line change 26
26
27
27
DECLARE_LOG_OBJECT ()
28
28
29
+ #include < pulsar/DeadLetterPolicyBuilder.h>
30
+
29
31
#include " ../lib/Future.h"
30
32
#include " ../lib/Utils.h"
31
- #include " pulsar/DeadLetterPolicyBuilder.h"
32
33
33
34
using namespace pulsar ;
34
35
Original file line number Diff line number Diff line change 18
18
*/
19
19
#include < gtest/gtest.h>
20
20
#include < pulsar/Client.h>
21
+ #include < pulsar/DeadLetterPolicyBuilder.h>
21
22
22
23
#include " HttpHelper.h"
23
24
#include " PulsarFriend.h"
26
27
#include " lib/MessageIdUtil.h"
27
28
#include " lib/UnAckedMessageTrackerEnabled.h"
28
29
#include " lib/Utils.h"
29
- #include " pulsar/DeadLetterPolicyBuilder.h"
30
30
31
31
static const std::string lookupUrl = " pulsar://localhost:6650" ;
32
32
static const std::string adminUrl = " http://localhost:8080/" ;
You can’t perform that action at this time.
0 commit comments