1
- // Copyright (c) 2020-2021 VMware, Inc. or its affiliates. All rights reserved.
1
+ // Copyright (c) 2020-2022 VMware, Inc. or its affiliates. All rights reserved.
2
2
//
3
3
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
4
4
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
@@ -29,10 +29,15 @@ public interface ConsumerBuilder {
29
29
/**
30
30
* Set the consumer to consume from a super stream (partitioned stream).
31
31
*
32
+ * <p>This is meant to be used with {@link #singleActiveConsumer()}.
33
+ *
32
34
* <p>This is an experimental API, subject to change.
33
35
*
36
+ * <p>RabbitMQ 3.11 or more is required.
37
+ *
34
38
* @param superStream
35
39
* @return this builder instance
40
+ * @see #singleActiveConsumer()
36
41
*/
37
42
ConsumerBuilder superStream (String superStream );
38
43
@@ -64,8 +69,45 @@ public interface ConsumerBuilder {
64
69
*/
65
70
ConsumerBuilder name (String name );
66
71
72
+ /**
73
+ * Declare the consumer as a single active consumer.
74
+ *
75
+ * <p>A single active consumer must set up a name with {@link #name(String)}.
76
+ *
77
+ * <p>Instances of the same application can declare several single active consumer instances with
78
+ * the same name and only one will be active at a time, meaning it will be the only one to get
79
+ * messages from the broker.
80
+ *
81
+ * <p>If the active consumer instance stops or crashes, the broker will choose a new active
82
+ * instance among the remaining ones.
83
+ *
84
+ * <p>This is an experimental API, subject to change.
85
+ *
86
+ * <p>RabbitMQ 3.11 or more is required.
87
+ *
88
+ * @return this builder instance
89
+ * @since 0.6.0
90
+ * @see #name(String)
91
+ */
67
92
ConsumerBuilder singleActiveConsumer ();
68
93
94
+ /**
95
+ * Set the listener for single active consumer updates.
96
+ *
97
+ * <p>This listener is usually set when manual offset tracking is used, either server-side or with
98
+ * an external datastore.
99
+ *
100
+ * <p>This is an experimental API, subject to change.
101
+ *
102
+ * <p>RabbitMQ 3.11 or more is required.
103
+ *
104
+ * @param consumerUpdateListener
105
+ * @return this builder instance
106
+ * @since 0.6.0
107
+ * @see #singleActiveConsumer()
108
+ * @see ConsumerUpdateListener
109
+ * @see #manualTrackingStrategy()
110
+ */
69
111
ConsumerBuilder consumerUpdateListener (ConsumerUpdateListener consumerUpdateListener );
70
112
71
113
/**
@@ -78,6 +120,7 @@ public interface ConsumerBuilder {
78
120
* @see SubscriptionListener
79
121
* @param subscriptionListener the listener
80
122
* @return this builder instance
123
+ * @since 0.5.0
81
124
*/
82
125
ConsumerBuilder subscriptionListener (SubscriptionListener subscriptionListener );
83
126
0 commit comments