-
Couldn't load subscription status.
- Fork 76
[FLINK-35477] Make initial cursor position configurable #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| import org.apache.flink.connector.pulsar.source.config.CursorVerification; | ||
|
|
||
| import org.apache.pulsar.client.api.ConsumerCryptoFailureAction; | ||
| import org.apache.pulsar.client.api.SubscriptionInitialPosition; | ||
| import org.apache.pulsar.client.api.SubscriptionMode; | ||
|
|
||
| import java.time.Duration; | ||
|
|
@@ -232,6 +233,13 @@ private PulsarSourceOptions() { | |
| code("StartCursor")) | ||
| .build()); | ||
|
|
||
| public static final ConfigOption<SubscriptionInitialPosition> PULSAR_INITIAL_CURSOR = | ||
| ConfigOptions.key(SOURCE_CONFIG_PREFIX + "initialCursor") | ||
| .enumType(SubscriptionInitialPosition.class) | ||
| .defaultValue(SubscriptionInitialPosition.Latest) | ||
| .withDescription( | ||
| Description.builder().text("Consumer initial position.").build()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add a bit more descriptive text here, e.g.: Initial cursor position of the consumer. |
||
|
|
||
| /////////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // The configuration for ConsumerConfigurationData part. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,7 +220,9 @@ private void checkPartitionChanges(Set<TopicPartition> fetchedPartitions, Throwa | |
| startCursor.position(partition.getTopic(), partition.getPartitionId()); | ||
|
|
||
| try { | ||
| position.setupSubPosition(pulsarClient, topic, subscriptionName); | ||
| if (sourceConfiguration.isResetSubscriptionCursor()) { | ||
| position.setupSubPosition(pulsarClient, topic, subscriptionName); | ||
| } | ||
|
Comment on lines
+223
to
+225
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the actual fix for FLINK-35477? And the rest of the changes are unrelated to the fix? |
||
| } catch (PulsarClientException e) { | ||
| throw new FlinkRuntimeException(e); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
StartCursor.latest().equals(startCursor)is also null-safe, shorter and does not require a util class