davsclaus commented on code in PR #18396:
URL: https://github.com/apache/camel/pull/18396#discussion_r2182518899
##########
components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/PubSubApiClient.java:
##########
@@ -407,10 +350,22 @@ public void onError(Throwable throwable) {
LOG.debug("logged in {}", consumer.getTopic());
}
case PUBSUB_ERROR_CORRUPTED_REPLAY_ID -> {
- LOG.error("replay id: " + replayId
- + " is corrupt. Trying to recover by
resubscribing with LATEST replay preset");
- replayId = null;
- initialReplayPreset = ReplayPreset.LATEST;
+ String currReplayId = null;
+ if (replayId != null) {
+ currReplayId = replayId;
+ } else if (initialReplayPreset ==
ReplayPreset.CUSTOM) {
+ currReplayId = initialReplayId;
+ }
+ if (fallbackToLatestReplayId) {
+ initialReplayPreset = ReplayPreset.LATEST;
+ LOG.error("replay id: " + currReplayId
Review Comment:
LOG.warn
##########
components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpoint.java:
##########
@@ -72,6 +72,13 @@ public class SalesforceEndpoint extends DefaultEndpoint {
@UriParam(label = "consumer", description = "The replayId value to use
when subscribing to the Pub/Sub API.")
private String pubSubReplayId;
+ @UriParam(label = "consumer",
+ description = "Whether the pub/sub consumer needs to fallback to
the latest replay id when the provided id is not valid. "
+ + "If set to false, the component will keep
retrying; in order to treat this as an exception you can "
+ + "use BridgeExceptionHandlerToErrorHandler and
handle the exception in the route.",
+ defaultValue = "false")
+ private boolean fallbackToLatestReplayId = false;
Review Comment:
Remove `= false`
##########
components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/PubSubApiClient.java:
##########
@@ -407,10 +350,22 @@ public void onError(Throwable throwable) {
LOG.debug("logged in {}", consumer.getTopic());
}
case PUBSUB_ERROR_CORRUPTED_REPLAY_ID -> {
- LOG.error("replay id: " + replayId
- + " is corrupt. Trying to recover by
resubscribing with LATEST replay preset");
- replayId = null;
- initialReplayPreset = ReplayPreset.LATEST;
+ String currReplayId = null;
+ if (replayId != null) {
+ currReplayId = replayId;
+ } else if (initialReplayPreset ==
ReplayPreset.CUSTOM) {
+ currReplayId = initialReplayId;
+ }
+ if (fallbackToLatestReplayId) {
+ initialReplayPreset = ReplayPreset.LATEST;
+ LOG.error("replay id: " + currReplayId
+ + " is corrupt. Trying to recover by
resubscribing with LATEST replay preset");
+ replayId = null;
+ } else {
+
consumer.getExceptionHandler().handleException(new InvalidReplayIdException(
+ "Invalid replay id: " + currReplayId,
Review Comment:
Maybe use the same word as above, that its corrupt, sine the error case is
ERROR_CORRPUTED
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]