Skip to content

Commit e9d7954

Browse files
committed
Add Javadoc for subscription listener
1 parent b8fdac3 commit e9d7954

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/main/java/com/rabbitmq/client/amqp/ConsumerBuilder.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ public interface ConsumerBuilder {
7474
*/
7575
StreamOptions stream();
7676

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+
*/
7786
ConsumerBuilder subscriptionListener(SubscriptionListener subscriptionListener);
7887

7988
/**
@@ -167,12 +176,36 @@ enum StreamOffsetSpecification {
167176
NEXT
168177
}
169178

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+
*/
170185
interface SubscriptionListener {
171186

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+
*/
172195
void preSubscribe(Context context);
173196

197+
/** Subscription context. */
174198
interface Context {
175199

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+
*/
176209
ConsumerBuilder.StreamOptions streamOptions();
177210
}
178211
}

0 commit comments

Comments
 (0)