File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
src/main/java/com/rabbitmq/client/amqp Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,15 @@ public interface ConsumerBuilder {
74
74
*/
75
75
StreamOptions stream ();
76
76
77
+ /**
78
+ * Set a listener to customize the subscription before the consumer is created (or recovered).
79
+ *
80
+ * <p>This callback is available for stream consumers.
81
+ *
82
+ * @param subscriptionListener subscription listener
83
+ * @return this builder instance
84
+ * @see SubscriptionListener
85
+ */
77
86
ConsumerBuilder subscriptionListener (SubscriptionListener subscriptionListener );
78
87
79
88
/**
@@ -167,12 +176,36 @@ enum StreamOffsetSpecification {
167
176
NEXT
168
177
}
169
178
179
+ /**
180
+ * Callback to modify a consumer subscription before the link creation.
181
+ *
182
+ * <p>This allows looking up the last processed offset for a stream consumer and attaching to this
183
+ * offset.
184
+ */
170
185
interface SubscriptionListener {
171
186
187
+ /**
188
+ * Pre-subscription callback.
189
+ *
190
+ * <p>It is called before the link is created but also every time it recovers, e.g. after a
191
+ * connection failure.
192
+ *
193
+ * @param context subscription context
194
+ */
172
195
void preSubscribe (Context context );
173
196
197
+ /** Subscription context. */
174
198
interface Context {
175
199
200
+ /**
201
+ * Stream options, to set the offset to start consuming from.
202
+ *
203
+ * <p>Only the {@link StreamOptions} are accessible, the {@link StreamOptions#builder()}
204
+ * method returns <code>null</code>
205
+ *
206
+ * @return the stream options
207
+ * @see StreamOptions
208
+ */
176
209
ConsumerBuilder .StreamOptions streamOptions ();
177
210
}
178
211
}
You can’t perform that action at this time.
0 commit comments