Skip to content

Commit 86ab68c

Browse files
committed
More Javadoc
1 parent 5f279fc commit 86ab68c

9 files changed

+723
-30
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface ConnectionBuilder extends ConnectionSettings<ConnectionBuilder>
3030
/**
3131
* Add {@link com.rabbitmq.client.amqp.Resource.StateListener}s to the connection.
3232
*
33-
* @param listeners
33+
* @param listeners listeners
3434
* @return this builder instance
3535
*/
3636
ConnectionBuilder listeners(Resource.StateListener... listeners);

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

+107
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,149 @@
1919

2020
import java.time.Instant;
2121

22+
/** API to configure and create a {@link Consumer}. */
2223
public interface ConsumerBuilder {
2324

25+
/**
26+
* The queue to consume from.
27+
*
28+
* @param queue queue
29+
* @return this builder instance
30+
*/
2431
ConsumerBuilder queue(String queue);
2532

33+
/**
34+
* The callback for inbound messages.
35+
*
36+
* @param handler callback
37+
* @return this builder instance
38+
*/
2639
ConsumerBuilder messageHandler(Consumer.MessageHandler handler);
2740

41+
/**
42+
* The initial number credits to grant to the AMQP receiver.
43+
*
44+
* <p>The default is 100.
45+
*
46+
* @param initialCredits number of initial credits
47+
* @return this buidler instance
48+
*/
2849
ConsumerBuilder initialCredits(int initialCredits);
2950

51+
/**
52+
* The consumer priority.
53+
*
54+
* @param priority consumer priority
55+
* @return this builder instance
56+
* @see <a href="https://www.rabbitmq.com/docs/consumer-priority">Consumer Priorities</a>
57+
*/
3058
ConsumerBuilder priority(int priority);
3159

60+
/**
61+
* Add {@link com.rabbitmq.client.amqp.Resource.StateListener}s to the consumer.
62+
*
63+
* @param listeners listeners
64+
* @return this builder instance
65+
*/
3266
ConsumerBuilder listeners(Resource.StateListener... listeners);
3367

68+
/**
69+
* Options for a consumer consuming from a stream.
70+
*
71+
* @return stream options
72+
* @see <a href="https://www.rabbitmq.com/docs/streams">Streams</a>
73+
* @see <a href="https://www.rabbitmq.com/docs/streams#consuming">Stream Consumers</a>
74+
*/
3475
StreamOptions stream();
3576

77+
/**
78+
* Build the consumer.
79+
*
80+
* @return the configured consumer instance
81+
*/
3682
Consumer build();
3783

84+
/**
85+
* Options for a consumer consuming from a stream.
86+
*
87+
* @see <a href="https://www.rabbitmq.com/docs/streams">Streams</a>
88+
* @see <a href="https://www.rabbitmq.com/docs/streams#consuming">Stream Consumers</a>
89+
*/
3890
interface StreamOptions {
3991

92+
/**
93+
* The offset to start consuming from.
94+
*
95+
* @param offset offset
96+
* @return stream options
97+
*/
4098
StreamOptions offset(long offset);
4199

100+
/**
101+
* A point in time to start consuming from.
102+
*
103+
* <p>Be aware consumers can receive messages published a bit before the specified timestamp.
104+
*
105+
* @param timestamp the timestamp
106+
* @return stream options
107+
*/
42108
StreamOptions offset(Instant timestamp);
43109

110+
/**
111+
* The offset to start consuming from.
112+
*
113+
* @param specification offset specification
114+
* @return stream options
115+
* @see StreamOffsetSpecification
116+
*/
44117
StreamOptions offset(StreamOffsetSpecification specification);
45118

119+
/**
120+
* The offset to start consuming from as an interval string value.
121+
*
122+
* <p>Valid units are Y, M, D, h, m, s. Examples: <code>7D</code> (7 days), <code>12h</code> (12
123+
* hours).
124+
*
125+
* @param interval the interval
126+
* @return stream options
127+
* @see <a href="https://www.rabbitmq.com/docs/streams#retention">Interval Syntax</a>
128+
*/
46129
StreamOptions offset(String interval);
47130

131+
/**
132+
* Filter values.
133+
*
134+
* @param values filter values
135+
* @return stream options
136+
* @see <a href="https://www.rabbitmq.com/docs/streams#filtering">Stream Filtering</a>
137+
*/
48138
StreamOptions filterValues(String... values);
49139

140+
/**
141+
* Whether messages without a filter value should be sent.
142+
*
143+
* <p>Default is <code>false</code> (messages without a filter value are not sent).
144+
*
145+
* @param matchUnfiltered true to send messages without a filter value
146+
* @return stream options
147+
*/
50148
StreamOptions filterMatchUnfiltered(boolean matchUnfiltered);
51149

150+
/**
151+
* Return the consumer builder.
152+
*
153+
* @return the consumer builder
154+
*/
52155
ConsumerBuilder builder();
53156
}
54157

158+
/** Offset specification to start consuming from. */
55159
enum StreamOffsetSpecification {
160+
/** Beginning of the stream. */
56161
FIRST,
162+
/** Last chunk of the stream. */
57163
LAST,
164+
/** Very end of the stream (new chunks). */
58165
NEXT
59166
}
60167
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
// info@rabbitmq.com.
1818
package com.rabbitmq.client.amqp;
1919

20+
/** Marker interface for providing credentials. */
2021
public interface CredentialsProvider {}

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

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// info@rabbitmq.com.
1818
package com.rabbitmq.client.amqp;
1919

20+
/** Default implementation of {@link UsernamePasswordCredentialsProvider}. */
2021
public class DefaultUsernamePasswordCredentialsProvider
2122
implements UsernamePasswordCredentialsProvider {
2223

0 commit comments

Comments
 (0)