You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andres Q <tu...@gmail.com> on 2020/02/27 16:05:08 UTC

catch error on Salesforce subscription

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

Re: catch error on Salesforce subscription

Posted by Andres Q <tu...@gmail.com>.
Hi Zoran, you are absolutely right... I was looking for a contrived
solution! thanks

El jue., 27 de feb. de 2020 a la(s) 20:33, Zoran Regvart (zoran@regvart.com)
escribió:

> 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
>

Re: catch error on Salesforce subscription

Posted by Zoran Regvart <zo...@regvart.com>.
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 <tu...@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