Hi Andrés,
I think it be easier to store the timestamp along with the replayId in
the database and then set it accordingly.

zoran

On Thu, Feb 27, 2020 at 5:05 PM Andres Q <tulsi...@gmail.com> wrote:
>
> Hi
>
> I have the following route definition:
>
> from("salesforce:data/ChangeEvents?replayId=" +
> replayId).process(this::processDataChange);
>
> This subscribes to Salesforce Change Data Capture events and works fine.
> The problem is that if replayId (which is stored on a DB) is old (older
> than 24 hours) then Salesforce will not recognize that replayId as valid,
> since it's outside the retention window they provide, and the route will
> throw an exception when it attempts to start the subscription, which is
> done asynchronously:
>
> org.apache.camel.component.salesforce.api.SalesforceException: Error
> subscribing to data/ChangeEvents: 400::The replayId {13277} you provided
> was invalid.  Please provide a valid ID, -2 to replay all events, or -1 to
> replay only new events.
>
> In that scenario I would like to react to that error and set the replayId
> to -2 and process new events accordingly, but I don't know how to be able
> to catch that Exception, since the error handling mechanisms I know of
> (onException, etc) work only for incoming messages.
>
> Thanks,
>
> Andrés



-- 
Zoran Regvart

Reply via email to