|
1 | 1 | /* |
2 | | - * Copyright (c) 2010-2022. Axon Framework |
| 2 | + * Copyright (c) 2010-2025. Axon Framework |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -94,26 +94,26 @@ protected AsyncFetcher(Builder<K, V, E> builder) { |
94 | 94 | */ |
95 | 95 | @Override |
96 | 96 | public Registration poll(Consumer<K, V> consumer, |
97 | | - RecordConverter<K, V, E> recordConverter, |
98 | | - EventConsumer<E> eventConsumer) { |
| 97 | + RecordConverter<K, V, E> recordConverter, |
| 98 | + EventConsumer<E> eventConsumer) { |
99 | 99 | return poll(consumer, recordConverter, eventConsumer, |
100 | | - e -> logger.warn("Error from fetching thread, should be handled properly", e)); |
| 100 | + e -> logger.warn("Error from fetching thread, should be handled properly", e)); |
101 | 101 | } |
102 | 102 |
|
103 | 103 | /** |
104 | 104 | * {@inheritDoc} |
105 | 105 | */ |
106 | 106 | @Override |
107 | 107 | public Registration poll(Consumer<K, V> consumer, RecordConverter<K, V, E> recordConverter, |
108 | | - EventConsumer<E> eventConsumer, RuntimeErrorHandler runtimeErrorHandler) { |
| 108 | + EventConsumer<E> eventConsumer, RuntimeErrorHandler runtimeErrorHandler) { |
109 | 109 | FetchEventsTask<K, V, E> fetcherTask = |
110 | 110 | new FetchEventsTask<>(consumer, |
111 | | - pollTimeout, |
112 | | - recordConverter, |
113 | | - eventConsumer, |
114 | | - activeFetchers::remove, |
115 | | - runtimeErrorHandler, |
116 | | - offsetCommitType); |
| 111 | + pollTimeout, |
| 112 | + recordConverter, |
| 113 | + eventConsumer, |
| 114 | + activeFetchers::remove, |
| 115 | + runtimeErrorHandler, |
| 116 | + offsetCommitType); |
117 | 117 |
|
118 | 118 | activeFetchers.add(fetcherTask); |
119 | 119 | executorService.execute(fetcherTask); |
@@ -162,22 +162,32 @@ public static final class Builder<K, V, E> { |
162 | 162 | */ |
163 | 163 | public Builder<K, V, E> pollTimeout(long timeoutMillis) { |
164 | 164 | assertThat(timeoutMillis, timeout -> timeout > 0, |
165 | | - "The poll timeout may not be negative [" + timeoutMillis + "]"); |
| 165 | + "The poll timeout may not be negative [" + timeoutMillis + "]"); |
166 | 166 | this.pollTimeout = Duration.ofMillis(timeoutMillis); |
167 | 167 | return this; |
168 | 168 | } |
169 | 169 |
|
170 | 170 | /** |
171 | | - * Set the {@code offsetCommitType}, options are: |
172 | | - * {@link OffsetCommitType#AUTO} let the Kafka consumer commit offsets automatically in background |
173 | | - * {@link OffsetCommitType#COMMIT_SYNC} let the Kafka consumer commit offsets synchronously after processing |
174 | | - * {@link OffsetCommitType#COMMIT_ASYNC} let the Kafka consumer commit offsets asynchronously after processing |
175 | | - * Defaults to {@code OffsetCommitType#AUTO} |
| 171 | + * Sets the {@code offsetCommitType} defining how the {@link FetchEventsTask} will commit offsets during |
| 172 | + * processing of events. |
| 173 | + * <p> |
| 174 | + * Options are: |
| 175 | + * <ul> |
| 176 | + * <li>{@link OffsetCommitType#AUTO} - let the Kafka consumer commit offsets automatically in background. |
| 177 | + * </li> |
| 178 | + * <li>{@link OffsetCommitType#COMMIT_SYNC} - let the Kafka consumer commit offsets synchronously after |
| 179 | + * processing.</li> |
| 180 | + * <li>{@link OffsetCommitType#COMMIT_ASYNC} - let the Kafka consumer commit offsets asynchronously after |
| 181 | + * processing.</li> |
| 182 | + * </ul> |
| 183 | + * <p> |
| 184 | + * Defaults to {@code OffsetCommitType#AUTO}, meaning the offset commit task happens in the background. |
176 | 185 | * |
177 | 186 | * @param offsetCommitType {@link OffsetCommitType} enum to specify the offset commit type |
178 | 187 | * @return the current Builder instance, for fluent interfacing |
179 | 188 | */ |
180 | 189 | public AsyncFetcher.Builder<K, V, E> offsetCommitType(OffsetCommitType offsetCommitType) { |
| 190 | + assertNonNull(offsetCommitType, "OffsetCommitType may not be null"); |
181 | 191 | this.offsetCommitType = offsetCommitType; |
182 | 192 | return this; |
183 | 193 | } |
|
0 commit comments